开发过程中安装一个vue项目的时候,每次执行npm install都会一直停在"fetchMetadata: sill resolveWithNewModule,最终会报一个

ERR! exited with error code: 128的错误

原因是某些依赖需要使用git下载,在访问git失败的情况下就会报此错误

网上的解决方案大致有两种:

1.ssh的方式替换成https方式,命令
git config --global url."https://".insteadOf git://

2.更换淘宝镜像,命令

npm config set registry https://registry.npm.taobao.org

这两种方法都使用过,结果还是不行,最终解决办法是通过修改Hosts 解决,在hosts文件追加如下内容。

此方法同样来自网络,但是搜索报错信息却找不到此解决方法,特此记录。

140.82.112.4 github.com
140.82.113.3 gist.github.com
185.199.108.153 assets-cdn.github.com
199.232.68.133 raw.githubusercontent.com
199.232.68.133 gist.githubusercontent.com
199.232.68.133 cloud.githubusercontent.com
151.101.192.133 camo.githubusercontent.com
199.232.68.133 avatars0.githubusercontent.com
199.232.68.133 avatars1.githubusercontent.com
199.232.68.133 avatars2.githubusercontent.com
199.232.68.133 avatars3.githubusercontent.com
199.232.68.133 avatars4.githubusercontent.com
199.232.68.133 avatars5.githubusercontent.com
199.232.68.133 avatars6.githubusercontent.com
199.232.68.133 avatars7.githubusercontent.com
199.232.68.133 avatars8.githubusercontent.com

Logo

前往低代码交流专区

更多推荐