yarn安装报错网络问题解决方案
报错为
info There appears to be trouble with your network connection. Retrying…
解决方案:
更换安装依赖的镜像,使用淘宝镜像安装
- 安装好后更换淘宝镜像
yarn config set registry https://registry.npm.taobao.org
- 移除原代理
yarn config delete proxy
npm config rm proxy
npm config rm https-proxy
- 安装cnpm镜像并使用代理registry
- 安装cnpm镜像
npm install -g cnpm --registry=https://registry.npm.taobao.org
- 使用代理registry
npm config set registry https://registry.npm.taobao.org
解决!
类似情况
- 删除代理
yarn config delete proxy
- 设置淘宝镜像
yarn config set registry https://registry.npm.taobao.org/
- 设置超时时间
yarn install --network-timeout 6000
超时时间是毫秒单位
当Yarn在安装依赖时遇到网络问题,可以尝试更换为淘宝镜像,通过`yarnconfigsetregistryhttps://registry.npm.taobao.org`命令设置。同时,删除代理配置,增加网络超时时间如`yarninstall--network-timeout60000`,能有效解决因网络导致的安装失败问题。



1171

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



