zl程序教程

您现在的位置是:首页 >  其他

当前栏目

安装 nrm 自由切换 npm 源 国内镜像提升下载速度

安装npm镜像 提升 切换 国内 自由 下载速度
2023-09-27 14:28:00 时间
 /Users/zhangzhi/code nrm -h Usage: nrm [options] [command] Commands: ls list all the registries current show current registry name use registry change registry to registry add registry url [home] add one custom registry del|rm registry delete one custom registry home registry [browser] open the homepage of registry with optional browser test [registry] show response time for specific or all registries help print this help Options: -h, --help output usage information -V, --version output the version number 

查看当前支持切换的源

 /Users/zhangzhi/code nrm ls npm ---- https://registry.npmjs.org/ cnpm --- http://r.cnpmjs.org/ * taobao - http://registry.npm.taobao.org/ edunpm - http://registry.enpmjs.org/ eu ----- http://registry.npmjs.eu/ au ----- http://registry.npmjs.org.au/ sl ----- http://npm.strongloop.com/ nj ----- https://registry.nodejitsu.com/ pt ----- http://registry.npmjs.pt/ 

上面列出了可选的 9个源,还用 * 号标记出了当前我使用的源


假如现在我想把 taobao 源 切换成 eu 的镜像源( 貌似走的教育网,我也不确定速度是不是快,只是演示切换)

 /Users/zhangzhi/code nrm use eu Registry has been set to: http://registry.npmjs.eu/ 

切换后的源列表

 /Users/zhangzhi/code nrm ls npm ---- https://registry.npmjs.org/ cnpm --- http://r.cnpmjs.org/ taobao - http://registry.npm.taobao.org/ edunpm - http://registry.enpmjs.org/ * eu ----- http://registry.npmjs.eu/ au ----- http://registry.npmjs.org.au/ sl ----- http://npm.strongloop.com/ nj ----- https://registry.nodejitsu.com/ pt ----- http://registry.npmjs.pt/ 

可以看到源已经切换成了 eu

你还可以添加已知的源,或者删除