npm安装依赖报 npm ERR! code Z_BUF_ERROR npm ERR! errno -5 npm ERR! zlib: unexpected end of file 这个错误解决方案

今天碰到了一个比较奇怪的问题,下载依赖有问题报错

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:UsersAdministratorAppDataRoaming
pm-cache\_logs2019-12-26T04_21_54_001Z-debug.log

看了挺多资料,有的说是更换为cnpm,结果还是没有起作用,然后发现这步操作 

解决方案如下

1.首先清除npm 缓存

npm cache clean --force

2.接下来再试一遍;

npm install

这样就好了,说实话 我也不知道是啥情况  但是后面就真的好了

原文地址:https://www.cnblogs.com/10ve/p/12101782.html