(新)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

如圖
圖片1
加載成功了,然後跑yarn install 就很順利pass了。

另外info提示網絡問題,我看網絡上絕大部份都是改成淘寶源。這個有可能解決一部分問題,但是還會有一些不管用的。
info There appears to be trouble with your network connection. Retrying…

這裏有一個方法:綁定host
直接將綁定源節點 域名+IP寫進host
你直接 dig registry.npm.taobao.org
圖2
然後將得到的節點IP綁定到host,再執行命令的時候會解決一部分網絡的問題。

完!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章