场景:

最近大家在使用yarn的时候出现下面这种提示的频率越来越高了:

例如:info There appears to be trouble with your network connection. Retrying…


问题描述:


原因分析:

info There appears to be trouble with your network connection. Retrying... 信息:

第一步:网络连接似乎出了点问题,请重试... 但仔细检查下来,网络并没有什么问题?

第二步:网络一切正常,那么问题就很可能出现在了代理连接上。

              查一下代理设置:  yarn config get registry    发现是淘宝源,那是怎么回事?

             
 

第三步:没查到原因那就,重新配置:详见解决方案。


解决方案:

更换安装依赖的镜像,使用淘宝镜像安装,代码如下:
1、安装好后更换淘宝镜像
yarn config set registry https://registry.npm.taobao.org

2、移除原代理
yarn config delete proxy
npm config rm proxy
npm config rm https-proxy

3、安装cnpm镜像并使用代理registry
安装cnpm镜像
npm install -g cnpm --registry=https://registry.npm.taobao.org
使用代理registry
npm config set registry https://registry.npm.taobao.org

 

4、npm install  可以了
 

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐