介绍

npm包有很多的镜像源,有时须要切换npm的源,nrm包就是解决疾速切换问题的。
nrm能够帮忙在不同的npm源地址之间轻松疾速地切换。

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/  skimdb -- https://skimdb.npmjs.com/registry

装置nrm

关上终端运行npm install -g nrm命令

$ npm install -g nrm

查看是否装置胜利: nrm --version

$ nrm --version

应用

列出可抉择的源nrm ls

$ 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/  skimdb -- https://skimdb.npmjs.com/registry

后面带 * 号的示意正在应用的源

切换应用的源nrm use npm

//switch registry to cnpm$ nrm use cnpm      Registry has been set to: http://r.cnpmjs.org/

增加一个源nrm add <registry> <url>

如果想增加一个源,终端执行命令nrm add <registry> <url> [home],reigstry为源名,url为源的门路,home为源的主页(可不写)

删除一个源nrm del <registry>

nrm del 命令不能删除nrm本人内置的源

测试源响应速度nrm test