使用 nrm 管理镜像源

  • 获取当前使用的镜像源
npm config get registry
https://registry.npmjs.org/
复制代码
  • 使用指定的镜像源
npm config set registry https://registry.npm.taobao.org/
复制代码
  • 使用 npm config 命令来更改镜像源太麻烦, 咱们使用 nrm 来帮咱们管理多个镜源
npm i nrm -g
nrm -V
1.2.1
复制代码
  • 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/
  npmMirror -- https://skimdb.npmjs.com/registry/
  edunpm ----- http://registry.enpmjs.org/
复制代码

nrm 列出了当前可切换使用的源, 左边带星号的表示当前正在使用的源。node

  • 使用列表中的源
nrm use nj
Registry has been set to: https://registry.nodejitsu.com/
复制代码
  • nrm 还能够用来测试镜像源的延迟
nrm test yarn
cnpm --- 208ms

nrm test taobao
taobao - 102ms
复制代码
相关文章
相关标签/搜索