npm install --save-dev webpack 安裝報錯之爲npm設置代理

問題描述

進行wepack打包工具安裝時候報錯如下:

npm install --save-dev webpack
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/webpack failed, reason: connect ETIMEDOUT 104.16.19.35:443
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

處理步驟

<1> 首先,取消npm代理設置:

#輸入命令:
npm config set proxy null

<2>取消https-proxy

npm config set https-proxy null

<3>然後添加淘寶鏡像:

#輸入命令:
npm --registry https://registry.npm.taobao.org info underscore

<4>在.npmrc文件中添加代理:
.npmrc一般在用戶目錄下:C:\Users\for jld.npmrc

registry = https://registry.npm.taobao.org/

之後就可以愉快玩耍了。如下:
在這裏插入圖片描述

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