一、鏡像源鏈接切換
- 全局切換鏡像源:
npm config set registry http://registry.npm.taobao.org
- 查看鏡像源使用狀態:
npm get registry
- 全局切換官方鏡像源:
npm config set registry http://www.npmjs.org
二、使用 nrm 切換鏡像源
- 下載 nrm:
npm install -g nrm
- 查看可切換的鏡像源:
nrm ls
(*表示正在使用的鏡像源)
* npm -------- https://registry.npmjs.org/ yarn ------- https://registry.yarnpkg.com/ cnpm ------- http://r.cnpmjs.org/ taobao ----- https://registry.npm.taobao.org/ nj --------- https://registry.nodejitsu.com/ npmMirror -- https://skimdb.npmjs.com/registry/ edunpm ----- http://registry.enpmjs.org/
- 切換淘寶鏡像源:
nrm use taobao
注意:在Linux系統環境里面如果下載nrm后執行nrm ls
命令出現未找到命令,需要配置全局的軟鏈接:
sudo ln -s /home/nodejs/bin/nrm /usr/local/bin/
其中 /home/nodejs/bin/nrm
是指你本地安裝nodejs包的路徑。/usr/local/bin/
路徑是你的程序命令執行路徑,相當與Windows系統下的環境變量 PATH 路徑,配置后可以在系統的任意位置執行你的命令。
作者:銘記喜悅
鏈接:https://www.jianshu.com/p/944aad9487c5
來源:簡書
著作權歸作者所有。商業轉載請聯系作者獲得授權,非商業轉載請注明出處。