为什么node-npm在安装@ angular / cli时失败,校验和失败?

我正在使用节点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. 我将npmregistryconfiguration为http和https。 没有工作。
  2. 检查path操作系统pathvariables以及安装节点的目录。 一无所获。
  3. 试图清理npm和卸载和安装angular/ cli。 没有工作。

这是Windows上的构build问题,请尝试以下步骤:

 npm install -g node-gyp npm install --global windows-build-tools npm install -g angular-cli 

本地安装问题很难debugging,因为有很多的试验和错误,保存你已经尝试的结果和结果的列表。

这是对一系列build议的尝试。 我怀疑你已经尝试了许多这些,我希望这有助于组织你的努力。

  1. validationnpm registry : npm get registry (期望: https : npm get registry
  2. 将npm更新到最新版本: npm install npm@latest -g
  3. 删除package-lock.json
  4. 在重新安装之前完全卸载 npm,包括npm和npm-cache目录: sudo npm uninstall npm -g
  5. 完全卸载节点(再次包括npm)并重新安装

一路上,我遇到了类似的github问题:

  • 完整性校验和使用sha1时失败​​ – Node v8 + (请参阅评论)

嗨@Rogasch我会build议你完全卸载节点和NPM。 同时删除npm和npm-cache文件夹。 并使用node-v6.11.2-x86.msi安装程序重新安装。 👍3❤️1

我有同样的问题,npm install -g npm修复了我的问题

当我得到提交中包含的package-lock.json时,我得到了这个问题。 删除package-lock.json后,我可以再次运行npm install,而不会出错。

  • npm WARNregistryhttps://registry.npmjs.org/的意外警告 (OPEN)

通过转到%AppData%删除npmnpm-cache ,然后重试它将正常工作