npm 鏡像源

1.設置國內鏡像

a. 設置config

npm config set registry http://registry.npmjs.org 

b.編輯~/user/.npmrc

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

2.切換回原npm地址

npm config set registry http://registry.npmjs.org 

3.使用nrm管理registry地址

a.安裝依賴

npm install -g nrm

b.添加registry地址

nrm add npm http://registry.npmjs.org
nrm add taobao https://registry.npm.taobao.org

c.切換npm registry地址

nrm use taobao
nrm use npm

4.設置單個包的鏡像源

npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
npm config set phantomjs_cdnurl=https://npm.taobao.org/mirrors/phantomjs/
npm config set electron_mirror=https://npm.taobao.org/mirrors/electron/
npm config set registry=https://registry.npm.taobao.org
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章