PS:如果是windows要使用git命令窗口有些命令不生效,linux无所谓了。
1.一般我们都会用淘宝npm源:https://registry.npm.taobao.org/
npm set registry https://registry.npm.taobao.org/
2.安装
npm install -g nrm
3.查看源:当前源就是有*号的
$ 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/
4.添加源:
nrm add <registry> <url> # 例如: $ nrm add my-reg http://192.168.31.163:4873/
5.切换源:
nrm use <registry> $ nrm use my-reg Registry has been set to: http://192.168.31.163:4873/
6.删除源
nrm del <registry>
7.测试源速度
nrm test <registry> $ nrm test my-reg my-reg - 1209ms