I have a nodejs project versioned in a GIT repo. When I clone the project, the package-lock.json is included (as it should be) but when I execute "npm install" I get the error Unhandled rejection Error: Integrity check failed
If I delete the package-lock.json everything works
Package.json:
"dependencies": {
"aws-sdk": "^2.258.1",
"localmodule": "file:../LocalModule/dist/localmodule-1.1.1.tgz"
},
"devDependencies": {
"@types/chai": "^4.1.4",
"@types/mocha": "^5.2.2",
"@types/node": "^10.3.2",
"@types/sinon": "^5.0.1",
"aws-sdk-mock": "^2.0.0",
"chai": "^4.1.2",
"merge2": "^1.2.2",
"mocha": "^5.2.0",
"nps": "^5.9.2",
"nps-utils": "^1.6.0",
"sinon": "^5.0.10",
"sinon-chai": "^3.1.0",
"ts-node": "^6.1.1",
"typescript": "^3.1.6"
}
Full error:
Unhandled rejection Error: Integrity check failed:[email protected] extracted to /home/...
Wanted: sha512-atI2DklW/phzBW2RyPznpbepvl1aRh7Y0XHfguqv...
Found: sha512-9BeJ7UP5OY9cUDsNXlHaYL6Xqd1cARifioOEtF60...
at checksumError (/usr/lib/node_modules/npm/node_modules/cacache/lib/content/write.js:157:13)
at write (/usr/lib/node_modules/npm/node_modules/cacache/lib/content/write.js:35:22)
at putData (/usr/lib/node_modules/npm/node_modules/cacache/put.js:29:10)
at Object.x.put (/usr/lib/node_modules/npm/node_modules/cacache/locales/en.js:28:37)
at readFileAsync.then.data (/usr/lib/node_modules/npm/node_modules/pacote/lib/fetchers/file.js:38:28)
at tryCatcher (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:694:18)
at Promise._fulfill (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:638:18)
at /usr/lib/node_modules/npm/node_modules/bluebird/js/release/nodeback.js:42:21
at /usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:90:16
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
The package causing the problem is my local module. I have another project where I package the module always with the same name "localmodule-1.1.1.tgz". The checksum of this module is stored in the package-lock.json. When I change the content of the module, but not the name, npm detects that I am trying to install the same module but the checksum doesn't match.
had a same issue today and landed on this page. the above thing doesn't worked for me but after awhile fixed it by doing small work..hence posting it ..might be helpful to others.
just delete "package-lock.json" file and do npm install... :)
Try npm cache verify
or npm cache --force clean
. Then try npm install
. It worked for me.
To add to OP's answer, the error for me was a client produced private npm package that I first had to re-install with npm i <path to client package>
. After re-install, I was able to run npm i
and update all other packages successfully.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With