文章
问答
冒泡
npm 安装报错 "npm ERR! code Z_BUF_ERROR" 问题解决

最近在维护一个老项目,vue-cli脚手架的早期版本(我还是个不懂事的孩子),工程down下来先来一波常规操作npm install,一点都不意外的出现了报错,这种陈年老项目一般都是三无(一没readme,二没package-lock.json,三没依赖版本控制),俗话说如果报错了,那就再来一遍npm install,然鹅。。。

I’m all done. Running npm install for you to install the required dependencies. If this fails, try running the command yourself.

npm ERR! code Z\_BUF\_ERROR
npm ERR! errno -5
npm ERR! zlib: unexpected end of file

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Think\AppData\Roaming\npm-cache\_logs\2019-04-25T02\_29\_42\_180Z-debug.log\

就是这段报错了,,,
WeChat15dd973caf531f5fd238a46f0f7f81e7.png
上个图,,,
于是我按照提示,再执行了一遍 npm install,还是报错:
最后在网上找了很多资料,有替换 npm 国内源的方法(实测不行),后来找到一个清除 npm 缓存的方法,自测可行:
npm cache clean --force
然后执行 npm install 就可以了


关于作者

Roy
获得点赞
文章被阅读