Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fix a npm install failure with error code EINTEGRITY

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 [email protected]
3 info using [email protected]
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 [email protected] 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 ]
like image 789
GingerSwag Avatar asked Mar 04 '18 06:03

GingerSwag


3 Answers

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

like image 194
Jeff Peterson Avatar answered Sep 27 '22 18:09

Jeff Peterson


Running these commands solved my problem:

rm -rf package-lock.json node_modules
npm install

Reference

like image 43
Kodali444 Avatar answered Sep 27 '22 20:09

Kodali444


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

npm cache clean --force

like image 44
vishal rathod Avatar answered Sep 27 '22 20:09

vishal rathod