Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does the newest Angular CLI have a corrupted packages?

I installed the latest Node and Angular on Windows 10

npm install npm@latest -g 
npm install -g @angular/cli@latest 

But when I try to start a project ng new new-project I get the following error

    npm WARN tarball tarball data for @angular/compiler@^6.1.0 (sha512-TY6axB1c7VvYXf+ebFDq3Ej+edgii3CDxew8HnyTFAWeDF2Gh8io1vTYwtdyDka6U53ASaheM1HpiUjzvYH0jQ==) seems to be corrupted. Trying one more time. 
    npm WARN tar ENOENT: no such file or directory, open 'C:\Users\admin\Desktop\...\node_modules\.staging\@angular\common-6be83a81\locales\si.js'
    ...

    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\admin\AppData\Roaming\npm-cache\_logs\2018-10-08T01_01_48_404Z-debug.log
    Package install failed, see above.

I tried to uninstall Node.js and Angular CLI completely and then reinstall again

 npm install npm@latest -g 
 npm install -g @angular/cli@latest 

But still the same error ..... So I googled this issue. It seems like some people had it too, but then it magically disappeared for some people.

How to fix this?

like image 579
john Avatar asked Oct 08 '18 00:10

john


People also ask

What is the latest version of Angular CLI?

The Angular latest Official stable version is Angular v13. 2.5, which is released on 2nd March 2022.

How do I fix Angular installation error?

To solve the error "ng: command not found", install the angular cli package globally by running npm install -g @angular/cli@latest and restart your terminal. If the command fails, run it with sudo and make sure the correct PATH is set in your system's environment variable.

Why do I get npm error?

The npm ERR! code 1 error usually occurs when you run the npm install command. This cause of this error is that one of the dependencies you define in your package. json file fails to be installed properly on your computer.


2 Answers

I was getting the same below error when attempting to a create new project using ng new command.

npm WARN tarball tarball data for @angular/compiler@~7.2.0 (sha512-5yb4NcLk8GuXkYf7Dcor4XkGueYp4dgihzDmMjYDUrV0NPhubKlr+SwGtLOtzgRBWJ1I2bO0S3zwa0q0OgIPOw==) seems to be corrupted. Trying one more time.

I tried many things but what did not worked and what finally worked for me I have listed below. My working node version is 12.2.0 and npm version is 6.9.0 (i.e. latest version).

What did not worked:

  1. Downgraded node js to other lower versions (tried many version)
  2. Deleted package-lock.json file from project and executed npm install
  3. Executed npm install --registry https://registry.cnpmjs.org instead of npm install
  4. Deleted npm and npm-cache folders from AppData\Roaming and then again installed node js
  5. Deleted node_modules folder, executed npm update and then executed npm install
  6. Executed npm cache clean --force and then executed npm install
  7. Reinstalled @angular/cli
  8. Checked for any firewall / antivirus (in my case it was disabled)
  9. Opened node command prompt as an administrator
  10. Checked user permissions for the project folder

Finally what worked is:

Installed the component for which it was giving error. npm install -global @angular/compiler

like image 163
Reyan Chougle Avatar answered Oct 11 '22 13:10

Reyan Chougle


I had the same problem with node 12.13.0 and npm 6.13.0

npm WARN tarball tarball data for @angular/compiler@^7.2.11 (sha512-5yb4NcLk8GuXkYf7Dcor4XkGueYp4dgihzDmMjYDUrV0NPhubKlr+SwGtLOtzgRBWJ1I2bO0S3zwa0q0OgIPOw==) seems to be corrupted. Trying one more time.

For me the problem was npm. After upgrading npm to the newest version with npm i -g npm@latest the problem vanished. So it seems to be a problem with npm itself and not the Angular/CLI.

like image 22
ochs.tobi Avatar answered Oct 11 '22 13:10

ochs.tobi