1. 程式人生 > >yarn install npm install (轉載)

yarn install npm install (轉載)

 

解決 npm i 及 yarn install 都無法進行安裝的問題和node-sass安裝太慢的問題

2018年03月31日 19:49:07  閱讀數:2906 所屬專欄: 構建與除錯工具整理與總結 Git 技術整理和分享  

今天經過長時間的嘗試和搜尋,設定是切換各種映象源的嘗試,都無法正常安裝,目前已找到解決方法了,一開始網上並沒有確切的答案,但是經過不斷的試錯,終於找到了問題的源頭,現在分享下,避免以後其他人走太多彎路。

發現問題

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... info There appears to be trouble with your network connection. Retrying... error An unexpected error occurred: "https://registry.npm.taobao.org/autoprefixer: tunneling socket could not be established, cause=connect ETIMEDOUT 10.129.49.21:8080".

 

經過沉著冷靜的思考後,分析關鍵詞:tunneling socket could not be established

通過百度和Google搜尋引擎的幫助,終於發現瞭解決方案

解決方案

代理出現了問題,刪除之

npm config rm proxy 
npm config rm https-proxy

 

刪除之後一切ok

對node-sass映象源進行設定

yarn config set sass-binary-site http://npm.taobao.org/mirrors/node-sass
或者
npm config set sass-binary-site http://npm.taobao.org/mirrors/node-sass

 

參考連結