在安装软件包的deps时,我遇到了以下错误:
$ 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
问题在于我的Modernizr
依赖:
"dependencies": {
"Modernizr": "https://modernizr.com/download?setclasses-flash"
}
有没有办法解决这个问题或忽略这个完整性检查?
现在我得跑
npm i https://modernizr.com/download?setclasses-flash
同样,为了让事情正常工作,它重写了"Modernizr"
在我的package-lock.json
中的"Modernizr"
字段。每次从这个链接获取Modernizr
包时,都会发生这种情况,并且需要重新安装我的包依赖项(例如,每次在CI构建时)。
如果没有别的办法解决这个问题呢?我希望我不必将package-lock.json
放在我的.gitignore
文件中:
关于我的环境的更多数据:
$ npm -v
5.0.3
$ node -v
v6.11.0
发布于 2018-05-07 10:07:40
我终于解决了这个问题。
我们的团队摆脱了不使用SEMVER符号的URL依赖关系,在本例中使用了https://modernizr.com/download?setclasses-flash
,并在webpack
中使用了modernizr-loader
。在npm上也有gulp
和grunt
工具的等价物,挑选并使用您最喜欢的工具。
在使用它们之后,我们最终摆脱了返回EINTEGRITY
npm错误而不使用package-lock.json
或node_modules
。
发布于 2021-01-31 19:14:47
编辑包-lock.json,在本例中找到要跳过的那个--它失败的那个
sha1-tU7jWojzuU8MIY2VLAx+BwluNo0
并从其中删除完整性参数,即
},
"range-parser": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz",
"integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=",
"dev": true
},
为了..。
},
"range-parser": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz",
"dev": true
},
运行npm安装后,将检查其余部分,跳过此完整性。
发布于 2017-07-30 20:56:45
完整性字段的要点是在发生更改时提醒您,因此如果不希望它存在,可以在npmrc中禁用Packg-lock.json文件。只需设置package-lock=false
注:我是现代派的开发人员,并与npm团队就这个问题进行了交谈。其根本原因似乎是npm5和早期版本之间SHA类型的更改。核化node_modules
文件夹将修复它
https://stackoverflow.com/questions/44699090
复制相似问题