我在运行sudo npm安装时得到这个错误。在我的服务器上,npm已经安装好了。我试过删除包锁。Json文件,并运行NPM缓存清理-force,但它没有工作。

我的npm版本是5.3.0。

错误:

npm ERR! code EINTEGRITY
npm ERR! sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA== integrity checksum failed when using sha512: wanted sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA== but got sha512-WXI95kpJrxw4Nnx8vVI90PuUhrQjnNgghBl5tn54rUNKZYbxv+4ACxUzPVpJEtWxKmeDwnQrzjc0C2bYmRJVKg==. (65117 bytes)

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2017-11-29T05_33_52_182Z-debug.log

当前回答

试试这个

  Step-1) Delete package-lock.json from root folder.
  Step-2) Delete node_modules folder
  Step-3) run npm install command in root

其他回答

我被困在这个问题上很长一段时间,这就是帮助我的东西。

试试这个:

npm cache clean --force
npm install --update-binary --no-shrinkwrap

在深入研究GitHub问题后找到了这个答案!!

将.npmrc和注册表更新为https://对我来说很有效

registry=https://registry.npmjs.org/

我也有同样的问题。我使用yarn而不是npm来安装依赖项,它是有效的。

yarn add *****

在我执行这个命令之前

npm install typescript -g

改变命令后,它工作得很好。

npm install -g typescript

这一点还没有提到,但请确保您的系统时间是正确的。如果太不同步,将导致一个EINTEGRITY错误。当你在执行npm publish / install时。