Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nrm 快速切换 NPM 源 #4

Open
SunXinFei opened this issue Mar 14, 2018 · 2 comments
Open

nrm 快速切换 NPM 源 #4

SunXinFei opened this issue Mar 14, 2018 · 2 comments

Comments

@SunXinFei
Copy link
Owner

因为国内的开发者一般为了速度,是将自己的npm镜像设为taobao的镜像源,nrm 是一个 NPM 源管理器,相比每次切换时都手动指定相应参数,使用nrm 要方便的多,允许你快速地在NPM 源间切换:

安装
npm install -g nrm

列出可选的源
带 * 的是当前使用的源,上面的输出表明当前源是官方源。

nrm ls
  npm ---- https://registry.npmjs.org/
  cnpm --- http://r.cnpmjs.org/
* taobao - https://registry.npm.taobao.org/
  nj ----- https://registry.nodejitsu.com/
  rednpm - http://registry.mirror.cqupt.edu.cn/
  npmMirror  https://skimdb.npmjs.com/registry/
  edunpm - http://registry.enpmjs.org/

切换源
切换到npm

 nrm use npm
Registry has been set to: https://registry.npmjs.org/

增加源
你可以增加定制的源,特别适用于添加企业内部的私有源。
nrm add <registry> <url> [home]

删除源
nrm del <registry>

测试某个源速度

nrm test taobao
* taobao - 224ms

测试全部源速度

nrm test
  npm ---- 2115ms
  cnpm --- 283ms
* taobao - 267ms
  nj ----- Fetch Error
  rednpm - Fetch Error
  npmMirror  1028ms
  edunpm - Fetch Error
@SunXinFei SunXinFei changed the title NRM nrm 快速切换 NPM 源 Mar 14, 2018
@Liquor-Lorry
Copy link

前面的都没问题,最后测试速度的时候全部都是 Fetch Error为什么?

@SunXinFei
Copy link
Owner Author

前面的都没问题,最后测试速度的时候全部都是 Fetch Error为什么?

现在基本不用nrm,直接设置全局的,平时也不需要切来切去

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants