(新)yarn 错误There appears to be trouble with your network connection. Retrying

yarn 错误There appears to be trouble with your network connection. Retrying

先交代环境:
Ubuntu18
yarn --version
1.22.4
npm -v
6.14.4
node -v
v12.16.3

执行操作后报错信息
#yarn install
yarn install v1.22.4
[1/4] Resolving packages…
[2/4] Fetching packages…
info There appears to be trouble with your network connection. Retrying…
info There appears to be trouble with your network connection. Retrying…
info There appears to be trouble with your network connection. Retrying…
error An unexpected error occurred: “https://registry.npm.taobao.org/prettier/download/prettier-2.0.5.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fprettier%2Fdownload%2Fprettier-2.0.5.tgz: unexpected end of file”.

info If you think this is a bug, please open a bug report with the information provided in “/root/zbg_contract_website_h5_app_new/yarn-error.log”.

这里yarn install 过程中会有一个Fetching:
[2/4] Fetching packages…
[################################################################################] 1598/1602

这里有一个校验过程,这个文件你直接放到浏览器里是可以下载下来的。
所以这里使用 yarn add 直接添加这个依赖
yarn add
https://registry.npm.taobao.org/prettier/download/prettier-2.0.5.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fprettier%2Fdownload%2Fprettier-2.0.5.tgz

如图

加载成功了,然后跑yarn install 就很顺利pass了。

另外info提示网络问题,我看网络上绝大部份都是改成淘宝源。这个有可能解决一部分问题,但是还会有一些不管用的。
info There appears to be trouble with your network connection. Retrying…

这里有一个方法:绑定host
直接将绑定源节点 域名+IP写进host
你直接 dig registry.npm.taobao.org
(新)yarn 错误There appears to be trouble with your network connection. Retrying_第1张图片
然后将得到的节点IP绑定到host,再执行命令的时候会解决一部分网络的问题。

完!

你可能感兴趣的:(个人日志)