nrm 是基于 Node.js 开发的工具,必须先安装 Node.js 和 npm
全局安装:
npm install -g nrm
查看npm源:
nrm ls
所有的npm源示例:
npm -------- https://registry.npmjs.org/
yarn ------- https://registry.yarnpkg.com/
cnpm ------- http://r.cnpmjs.org/
taobao ----- https://registry.npmmirror.com/ # 淘宝源(原淘宝 npm 源已迁移至此)
nj --------- https://registry.nodejitsu.com/
npmMirror -- https://skimdb.npmjs.com/registry/
切换源:
# 切换到淘宝源(源名称对应 nrm ls 列表中的名称,此处为 taobao)
nrm use taobao
新增:
# 示例:添加一个名为 myregistry 的自定义源,地址为 https://registry.mycompany.com/
nrm add myregistry https://registry.mycompany.com/
删除:
# 示例:删除刚才添加的 myregistry 自定义源
nrm del myregistry
测试访问速度:
# 示例:测试淘宝源的访问速度
nrm test taobao
# 测试所有源的访问速度
nrm test