初始拉代碼運行【vue3 - ts - vite】前端項目,出現以下報錯:
或者:
分析:問題出現在代理連接上,可采用以下解決方案進行解決。
解決方案一:
- 更換安裝依賴的鏡像,使用淘寶鏡像安裝,代碼如下:
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
解決方案二:
??有些體積比較大的文件,比如react-dom-16.12.0.tgz,下載超時,被認為網絡鏈接的問題,所以需要修改網絡超時的時間,上面文件中的600000是指600000/1000 = 600秒,即5分鐘。在項目根目錄下創(chuàng)建 .yarnrc
的文件,并附上以下代碼:文章來源:http://www.zghlxwxcb.cn/news/detail-528120.html
yarn config set registry https://registry.npm.taobao.org
解決方法三:
??刪除yarn.lock
文件重新安裝依賴,但可能會導致部分依賴包版本發(fā)生變化,會有影響兼容性的可能。因此最好保留,在yarn.lock
文件中全局替換https://registry.yarnpkg.com
為https://registry.npmmirror.com
,然后重新安裝。文章來源地址http://www.zghlxwxcb.cn/news/detail-528120.html
到了這里,關于解決報錯:info There appears to be trouble with your network connection. Retrying...的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!