node.js - 为什么 npm 抛出错误 "checksum failed while installing @angular/cli"?

标签 node.js angular npm angular-cli npm-install

我正在使用 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 检查失败时,我得到的都是这些。我尝试了以下操作:

  1. 我将 npm 注册表同时配置为 http 和 https。没用。
  2. 检查路径操作系统路径变量,以及 Node 所在的目录 安装。什么也没找到。
  3. 尝试清理 npm 并卸载和安装 angular/cli。 没用。

最佳答案

本地设置问题很难调试,因为需要进行大量试验和错误,并保留您尝试过的内容和结果的列表。

这是对建议列表的尝试。我怀疑您已经尝试过其中的许多方法,我希望这有助于组织您的工作。

  1. 验证 npm registry : npm get registry(预期:https://registry.npmjs.org/)
  2. 将 npm 更新到最新:npm install npm@latest -g
  3. 删除package-lock.json
  4. Uninstall npm 完全在 reinstalling 之前,包括 npm 和 npm-cache 目录:sudo npm uninstall npm -g
  5. 完全卸载 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/

相关文章:

node.js - 如何在 nodejs 中禁用 SSL 3.0 和 TLS 1.0

node.js - 从 nodejs 到 https url 的 Rest API,端口 8443 抛出错误

angular - 为什么在组件中直接访问 Akita Queries

javascript - Highcharts 如何在同一行上对齐两个图表 yAxis

angular - 如何在网关项目中添加外部 javascript 库

javascript - 没有这样的文件或目录 react-native/scripts/libraries

html - Jade 到 HTML/CSS

javascript - 如何正确导出 Node.js 模块中的变量以使其对单元测试可见

javascript - 为什么 "message.channel.find"不是函数?

node.js - 需要并覆盖模块作用域变量以进行测试