node.js - 在 npm Install 我收到“未处理的拒绝错误:完整性检查失败”,但是当我删除 package-lock.json 时,错误消失了
问题描述
我有一个在 GIT 存储库中版本化的 nodejs 项目。当我克隆项目时,包含 package-lock.json(应该如此)但是当我执行“npm install”时出现错误Unhandled rejection Error: Integrity check failed
如果我删除 package-lock.json 一切正常
- 节点版本:8.14.0
- npm 版本:6.5.0
包.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"
}
完整错误:
Unhandled rejection Error: Integrity check failed:from@0.1.7 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)
解决方案
导致问题的包是我的本地模块。我有另一个项目,我总是用相同的名称“localmodule-1.1.1.tgz”打包模块。该模块的校验和存储在 package-lock.json 中。当我更改模块的内容而不是名称时,npm 检测到我正在尝试安装相同的模块,但校验和不匹配。
推荐阅读
- angular - 无法从 Angular SSR 中的资产中获取静态文件
- python - 使用pywin32在excel中写日期没有时间
- apache-kafka - 有没有办法在没有魔术字节的情况下使用 kafka 模式注册表?
- c# - 值不能为空。尝试使用 JsonConverter .net core 3.1 反序列化对象时出现(参数“值”)错误
- git - git rebase 什么时候会发生冲突?
- c# - WPF Canvas 元素对 Y 的含义都有不同的理解
- ruby - Ruby 想逐行读取文件并使用 gsub 获取特定部分
- java - 发送到 jar 的参数(以编程方式启动)已删除所有双引号
- regex - 基于多个分隔符的 Python df 拆分字符串并进一步搜索模式以填充列
- charts - 可视化图表:如何将 valueAxis 的比例设置为 Auto