1.问题说明
项目执行 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\2021-05-24T02_29_42_180Z-debug.log
再执行了一遍 npm install,还是报同样的错
2.问题解决
网上找资料试了几次,最后成功解决,清除 npm 缓存即可:
执行以下命令
npm cache clean --force
命令执行完成后,重新执行 npm install ,问题解决