nrm是一個NPM源管理器,允許你快速的在多個NPM源間切換
- npm
- cnpm
- taobao
- nj
- npm Mirror
常用npm源為npm
、cnpm
、tabbao
nrm使用方法
1.安裝
npm install -g nrm //全局安裝
2.列出可選源
nrm ls
npm ---- https://registry.npmjs.org/
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/
帶*
號的是當前使用的源,我當前使用的是taobao源
3.切換源
nrm use cnpm
Registry has been set to: http://r.cnpmjs.org/
4.增加源
你可以增加定制的源,特別適用于添加企業內部的私有源
nrm add <registry> <url> [home]
5.刪除源
nrm del <registry>
6.測試速度
通過nrm test
來測試相應源的響應時間,來選擇選擇合適的npm源
- 測試某個源的響應時間
nrm test npm
npm ---- 812ms //網絡會影響你的響應時間,所以可以多測幾次
- 測試所有源的響應時間
nrm test
npm ---- 2913ms
* cnpm --- 3041ms
taobao - 669ms
nj ----- Fetch Error
npmMirror 2771ms
edunpm - Fetch Error