Search code examples
node.jsnpmnpm-installmodernizr

EINTEGRITY: npm 5.0 integrity check and modernizr.com dependency


I've encountered this error when installing deps of my package:

$ npm i
npm ERR! code EINTEGRITY
npm ERR! sha1-tU7jWojzuU8MIY2VLAx+BwluNo0= integrity checksum failed when using sha1: wanted sha1-tU7jWojzuU8MIY2VLAx+BwluNo0= but got sha1-oXYP0kzpbhku0KU+phy353lbBhQ=. (26624 bytes)

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/tlenex/.npm/_logs/2017-06-22T10_18_19_773Z-debug.log

the problem is with my Modernizr dependency:

"dependencies": {
  "Modernizr": "https://modernizr.com/download?setclasses-flash"
}

is there any way to solve this or ignore this integrity check?

Currently I have to run

npm i https://modernizr.com/download?setclasses-flash

again to get things working, which overrides the "integrity" field for "Modernizr" in my package-lock.json. This may happen every time there is a change in Modernizr package fetched from this link and my package dependencies need to be reinstalled (for example, each time on CI build)

If there is no other way of solving this? I hope I wont have to place package-lock.json in my .gitignore file :(

More data about my enviroment:

$ npm -v
5.0.3
$ node -v
v6.11.0

Solution

  • I finally resolved this issue.

    Our team moved away from URL dependency without SEMVER notation, in this case https://modernizr.com/download?setclasses-flash and used modernizr-loader with webpack. There are also equivalents for gulp and grunt tools available on npm, pick and use one you like the most.

    After using them, we finally get rid of returning EINTEGRITY npm error without nuking package-lock.json or node_modules.