安装webpack-dev-server失败, 安装cnpm也失败,报npm err的错
配置环境时,npm install一直遇到同一个错误:
npm ERR! code Z_BUF_ERROR
npm ERR! errno -5
npm ERR! unexpected end of file
检查了下log,发现npm在获取patternfly依赖包元数据的时候总是会遭遇不可预料的文件末端
1486 silly fetchPackageMetaData error for patternfly@>=3.27.2 unexpected end of file
1487 silly pacote git manifest for components-jqueryui@github:components/jqueryui#1.12.1 fetched in 825ms
1488 silly resolveWithNewModule components-jqueryui@1.12.1 checking installable status
1489 verbose stack Error: unexpected end of file
1489 verbose stack at Gunzip.zlibOnError (zlib.js:152:15)
稍微搜索了一下相关问题,提到可能是网络不稳定的原因,开着VPN重试,还是不行。看到一种思路是更换国内镜像:
npm config set registry https://registry.npm.taobao.org ,
成功解决。
本文解决了一个常见的npm安装失败问题,特别是在获取patternfly依赖包元数据时遇到的Z_BUF_ERROR错误。通过更换为国内镜像源(如淘宝npm镜像),成功解决了安装过程中的网络问题。
759

被折叠的 条评论
为什么被折叠?



