Open SunXinFei opened 6 years ago
因为国内的开发者一般为了速度,是将自己的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 add <registry> <url> [home]
删除源 nrm del <registry>
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
前面的都没问题,最后测试速度的时候全部都是 Fetch Error为什么?
现在基本不用nrm,直接设置全局的,平时也不需要切来切去
因为国内的开发者一般为了速度,是将自己的npm镜像设为taobao的镜像源,nrm 是一个 NPM 源管理器,相比每次切换时都手动指定相应参数,使用nrm 要方便的多,允许你快速地在NPM 源间切换:
安装 npm install -g nrm
列出可选的源 带 * 的是当前使用的源,上面的输出表明当前源是官方源。
切换源 切换到npm
增加源 你可以增加定制的源,特别适用于添加企业内部的私有源。
nrm add <registry> <url> [home]
删除源
nrm del <registry>
测试某个源速度
测试全部源速度