Fix a npm install failure with error code EINTEGRITY

我只是一个虾纸丫 提交于 2020-06-14 07:35:47

问题


I have browsed through various similar posts here to no avail. They all arrive at similar solutions about using npm cache verify or npm cache clear, etc.

I have even went as far as to completely remove npm and node using every possible method and start fresh. I even resorted to using --force. Nothing has worked. I am sharing the latest log in hopes someone can point out my oversite or at least direct me to a possible solution.

I am sharing the latest log below.

========================================================================

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'i',
1 verbose cli   'npm',
1 verbose cli   '-g',
1 verbose cli   '--force' ]
2 info using npm@5.6.0
3 info using node@v8.9.4
4 warn using --force I sure hope you know what you are doing.
5 verbose npm-session 9e6a63471e97c268
6 silly install loadCurrentTree
7 silly install readGlobalPackageData
8 http fetch GET 200 https://registry.npmjs.org/npm 151ms
9 silly pacote tag manifest for npm@latest fetched in 302ms
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 silly install loadShrinkwrap
13 silly install loadAllDepsIntoIdealTree
14 silly resolveWithNewModule npm@5.7.1 checking installable status
15 silly pacote trying https://registry.npmjs.org/npm/-/npm-5.7.1.tgz by hash: sha512-r1grvv6mcEt+nlMzMWPc5n/z5q8NNuBWj0TGFp1PBSFCl6ubnAoUGBsucYsnZYT7MOJn0ha1ptEjmdBoAdJ+SA==
16 silly pacote data for sha512-r1grvv6mcEt+nlMzMWPc5n/z5q8NNuBWj0TGFp1PBSFCl6ubnAoUGBsucYsnZYT7MOJn0ha1ptEjmdBoAdJ+SA== not present. Using manifest.
17 verbose stack Error: sha512-r1grvv6mcEt+nlMzMWPc5n/z5q8NNuBWj0TGFp1PBSFCl6ubnAoUGBsucYsnZYT7MOJn0ha1ptEjmdBoAdJ+SA== integrity checksum failed when using sha512: wanted sha512-r1grvv6mcEt+nlMzMWPc5n/z5q8NNuBWj0TGFp1PBSFCl6ubnAoUGBsucYsnZYT7MOJn0ha1ptEjmdBoAdJ+SA== but got sha512-iBtbJV6DQB9dnO+DHun+8z2zKH2zz8pd5nJQL1NNwCxzeYJnSKIa/pmkgRHxYDIhEkRUKbm8wVdQuwxnaL5jhg==. (2162194 bytes)
17 verbose stack     at Transform.on (/usr/local/lib/node_modules/npm/node_modules/ssri/index.js:275:19)
17 verbose stack     at emitNone (events.js:111:20)
17 verbose stack     at Transform.emit (events.js:208:7)
17 verbose stack     at endReadableNT (_stream_readable.js:1055:12)
17 verbose stack     at _combinedTickCallback (internal/process/next_tick.js:138:11)
17 verbose stack     at process._tickCallback (internal/process/next_tick.js:180:9)
18 verbose cwd /Users/jasongribble
19 verbose Darwin 16.7.0
20 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "i" "npm" "-g" "--force"
21 verbose node v8.9.4
22 verbose npm  v5.6.0
23 error code EINTEGRITY
24 error sha512-r1grvv6mcEt+nlMzMWPc5n/z5q8NNuBWj0TGFp1PBSFCl6ubnAoUGBsucYsnZYT7MOJn0ha1ptEjmdBoAdJ+SA== integrity checksum failed when using sha512: wanted sha512-r1grvv6mcEt+nlMzMWPc5n/z5q8NNuBWj0TGFp1PBSFCl6ubnAoUGBsucYsnZYT7MOJn0ha1ptEjmdBoAdJ+SA== but got sha512-iBtbJV6DQB9dnO+DHun+8z2zKH2zz8pd5nJQL1NNwCxzeYJnSKIa/pmkgRHxYDIhEkRUKbm8wVdQuwxnaL5jhg==. (2162194 bytes)
25 verbose exit [ 1, true ]

回答1:


I just experienced this issue as well at work. The cause was that the package-lock.json file in our master branch was outdated, containing old integrity values. By deleting the package-lock.json file, I was able to run npm install and had no more EINTEGRITY errors.

I found the answer to this problem in another SO post: Integrity checksum failure while installing API Connect toolkit #apiconnect.

They came up with the answer via this GitHub issue comment for npm: https://github.com/npm/npm/issues/16861#issuecomment-305527498




回答2:


Running these commands solved my problem:

rm -rf package-lock.json node_modules
npm install

Reference




回答3:


If this error occurs during the project creation in react-native, then run:

npm cache clean --force




回答4:


I deleted node_modules, the package-lock.json in the solution folder, then I re ran npm install, it perfectly worked for me. refer this- enter image description here



来源:https://stackoverflow.com/questions/49092723/fix-a-npm-install-failure-with-error-code-eintegrity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!