我正在使用 node v6.11.5 和 npm 3.10.10 以及 64 位操作系统,在安装 @angular/cli 时出现以下错误:
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
从昨晚开始,我一直在尝试解决这个问题,但每次 shasum 检查失败时,我得到的都是这些。我尝试了以下操作:
- 我将 npm 注册表同时配置为 http 和 https。没用。
- 检查路径操作系统路径变量,以及 Node 所在的目录 安装。什么也没找到。
- 尝试清理 npm 并卸载和安装 angular/cli。 没用。
最佳答案
本地设置问题很难调试,因为需要进行大量试验和错误,并保留您尝试过的内容和结果的列表。
这是对建议列表的尝试。我怀疑您已经尝试过其中的许多方法,我希望这有助于组织您的工作。
- 验证 npm registry :
npm get registry
(预期:https://registry.npmjs.org/) - 将 npm 更新到最新:
npm install npm@latest -g
- 删除
package-lock.json
- Uninstall npm 完全在 reinstalling 之前,包括 npm 和 npm-cache 目录:
sudo npm uninstall npm -g
- 完全卸载 Node (再次包括 npm)并重新安装
一路上,我确实遇到过类似的github问题:
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.
关于node.js - 为什么 npm 抛出错误 "checksum failed while installing @angular/cli"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46987440/