当我运行命令 npm install npm@latest -g
我遇到以下错误:-
npm WARN tar zlib error: unexpected end of file
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dk\AppData\Roaming\npm-cache_logs\2018-04-10T03_25_52_880Z-debug.log
我用谷歌搜索并尝试了很多东西,但没有任何效果。
原文由 F11 发布,翻译遵循 CC BY-SA 4.0 许可协议
对于任何偶然发现这个问题的人,如果您在
npm install
上遇到相同的错误消息,那么npm install --no-package-lock
为我解决了这个问题。正如上面 Mohit Mutha 评论中引用的 Github 问题 中所建议的那样,如果命令在 CI/CD 管道中运行,或者在我的情况下,在 Docker 中运行,则尤其如此。
编辑: 原因是
package-lock.json
文件已经存在于您的 Docker 映像或 CI 管道中完整的细节