1、安装:在命令行执行 →npm install -g nrm ,进行全局安装
2、查看可用的源:执行命令→nrm ls,如下所示, 带*号的是当前使用的源
PS E:\code> 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/
3、切换源(如切换到taobao源):执行命令→nrm use taobao,然后在进行查看,已经切换完毕
PS E:\code> nrm use taobao Registry has been set to: https://registry.npm.taobao.org/ PS E:\code> 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/
4、添加源:执行命令→nrm add 源名称 源路径
PS E:\code> nrm add myProject http://192.168.0.1:8080/project add registry myProject success PS E:\code> 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/ myProject http://192.168.0.1:8080/project/
5、删除原:执行命令→nrm del 源名称
PS E:\code> nrm del myProject [..................] - : delete registry myProject success PS E:\code> 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/
6、测试源的响应时间:执行命令→nrm test 源名称
PS E:\code> nrm test npm npm ---- 1035ms PS E:\code> nrm test taobao * taobao - 149ms