使用 npm 安裝套件時出現 ETIMEDOUT
的錯誤,錯誤訊息中有提示可能是 proxy 的問題
yarn 安裝時 Error 是 ETIMEDOUT
yarn 是使用 npm 設定
npm config set proxy http://UserName:password@proxyserver:proxyport
npm config set https-proxy http://UserName:password@proxyserver:proxyport
npm config set proxy http://domain%5CUserName:password@proxyserver:proxyport
npm config set https-proxy http://domain%5CUserName:password@proxyserver:proxyport
npm config set strict-ssl false
npm config set registry "http://registry.npmjs.org/"
proxy=http://UserName:password@proxyserver:proxyport
https_proxy= http://UserName:password@proxyserver:proxyport
proxy=http://UserName:password@proxyserver:proxyport
https_proxy= http://UserName:password@proxyserver:proxyport
strict-ssl=false
registry=http://registry.npmjs.org/
存檔後若未生效,請重啟 command line
npm config get proxy
npm config get https_proxy
[實測後下面的設定非必要]
npm config get registry
npm config get strict-ssl
npm --proxy http://UserName:password@proxyserver:proxyport install -g packagename