11

I'm using node v6.11.5 and npm 3.10.10 and 64-bit OS, and while installing @angular/cli I'm getting the following error:

C:\WINDOWS\system32>npm install -g @angular/cli
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "@angular/cli"
npm ERR! node v6.11.5
npm ERR! npm  v3.10.10

npm ERR! shasum check failed for C:\Users\Shubham\AppData\Local\Temp\npm-6192-9e
acb63c\registry.npmjs.org\rxjs\-\rxjs-5.5.2.tgz
npm ERR! Expected: 28d403f0071121967f18ad665563255d54236ac3
npm ERR! Actual:   c2b697120c7dc0e6728da0e7636b90e15723cc24
npm ERR! From:     http://registry.npmjs.org/rxjs/-/rxjs-5.5.2.tgz
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     C:\WINDOWS\system32\npm-debug.log

I'm trying to solve this since last night, but each time this shasum check failed is all I'm getting. I tried the following things:

  1. I configured the npm registry to both http and https. Didn't worked.
  2. Checked the path OS path variables, and the directory where node is installed. Found nothing.
  3. Tried to clean npm and uninstalling and installing angular/cli. Didn't worked.
5
  • Did you see this thread from 2012?: github.com/npm/npm/issues/2701 (#issuecomment-40927831 explained a registry workaround). Oct 28, 2017 at 8:29
  • Is the checksum failing if you try to install any other modules? Oct 28, 2017 at 8:30
  • 1
    I didn't try installing modules other than @angular/cli. I'll update you about this in a moment. And yes I did checked that issue, It doesn't solve my problem though.
    – snegi
    Oct 28, 2017 at 10:05
  • @stealththeninja tried installing express but didn't worked.! any help yet ? If you need log file then I can provide you that as well.
    – snegi
    Oct 28, 2017 at 13:24
  • It's Monday, still into the console waving error.
    – snegi
    Oct 30, 2017 at 4:47

8 Answers 8

27

Local setup issues are tough to debug as there's a lot of trial and error, keeping a list of what you've tried and resulting outcomes.

This is an attempt at a list of suggestions. I suspect you've tried many of these, I hope this helps organize your efforts.

  1. Verify npm registry: npm get registry (expect: https://registry.npmjs.org/)
  2. Update npm to latest: npm install npm@latest -g
  3. Remove package-lock.json
  4. Uninstall npm completely before reinstalling, including npm and npm-cache directories: sudo npm uninstall npm -g
  5. Uninstall node completely (including npm again) and reinstalling

Along the way, I did come across similar github issues:

Hi @Rogasch I will suggest you to completely uninstall node and npm. Also delete npm and npm-cache folder. And reinstall using node-v6.11.2-x86.msi installer. 👍 3 ❤️ 1

i had the same issue and npm install -g npm fixed it for me

I got this problem when I got package-lock.json included in the commit. After removing package-lock.json I could run npm install without errors again.

2
  • 3
    still don't understand why we can have a checksum error when the registry is the same ? I don't understand why npm install -g npm solve the problem ? Oct 14, 2019 at 17:19
  • Me neither. However, npm install -g npm did the trick for me! Nov 18, 2021 at 12:35
6

I deleted the file package-lock.json and re-ran npm install.

3
  • 4
    it's not a good solution if you want to use the exact versions specified in the packakge-lock.json Oct 14, 2019 at 17:21
  • This answer resolved it for me. GIt never updated the package-lock. I thought this was a pipeline problem. Dec 1, 2020 at 20:01
  • 1
    This answer pointed out to me the way npm was working with checksums. I am working on a local npm repo on which I have deleted a version package and replaced it by another package at same version (very bad practise by the way, but I judged it was relevant in my specific case). I just replaced the sha512 values in the package-lock.json file instead of deleting the whole package-lock.json file Jan 6, 2022 at 11:01
3

it's a build problems on windows, try these steps:

npm install -g node-gyp

npm install --global windows-build-tools

npm install -g angular-cli
5
  • The same error is thrown while installing modules that you've recommended. Windows is not a problem. Please let me know if you have other solutions.
    – snegi
    Oct 29, 2017 at 16:44
  • what does those packages mean anyway. e.g. node-gyp @FatehM.
    – snegi
    Oct 29, 2017 at 16:53
  • it's a Node.js native addon build tool github.com/nodejs/node-gyp Oct 29, 2017 at 21:15
  • ok try to clean "npm cache clean", may be you have a corrupt version , and then restart again Oct 29, 2017 at 21:20
  • Angular-cli needs python Nov 28, 2017 at 0:33
1

On our Ubuntu 18.04, we just needed to do the following:

npm install npm@latest -g
1

Run powershell as an administrator and then run these commands.

npm cache clean --force

npm install -g @angular/cli
0

Delete npm and npm-cache by going to %AppData% and retry it will work fine

1
  • No I tried but it's not the cause. It's somewhere else.
    – snegi
    Nov 28, 2017 at 19:08
0

For me, my registry address was having http instead of https. When I checked my registry address with,

npm check registry 

I saw http://registry.npmjs.org/ . I changed my registry address with https version

npm config set https://registry.npmjs.org/

And all the problems went away.

0

Reinstall the node and then install the latest version of angular cli

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.