什麼是nrm
nrm 是一個 npm
源管理器,允許你快速地在 npm
源間切換。
安裝nrm
在命令行執行命令,npm install -g nrm
,全局安裝nrm。
使用
執行命令nrm ls
查看可選的源-鏡像源。
PS C:\work-project\rtm-ui\rtm-ui> 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/
其中,帶*的是當前使用的源,上面的輸出表明當前源是官方源。
切換
如果要切換到taobao源,執行命令nrm use taobao。
增加
你可以增加定製的源,特別適用於添加企業內部的私有源,執行命令 nrm add <registry> <url>,其中reigstry爲源名,url爲源的路徑。
nrm add registry http://192.168.10.127:8081/repository/npm-public/
刪除
執行命令nrm del <registry>
刪除對應的源。
測試速度
你還可以通過 nrm test
測試相應源的響應時間。
PS C:\work-project\rtm-ui\rtm-ui> nrm test npm
* npm ---- 1709ms