nrm——管理npm源不再繁琐

本文介绍了nrm,它是npm的镜像源管理工具。其特点是能专门管理镜像源,可通过一个命令直接切换,切换到淘宝源能加快资源下载速度。还说明了nrm的安装方法,以及使用方式,包括浏览、切换、添加、删除镜像源和测试镜像源速度。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

什么是nrm?

nrm——npm的镜像源管理工具

nrm有什么特点?

专门管理镜像源,之前都是从网上找到taobao的镜像源的网址,然后copy,现在有了这个,可以一个命令直接切换。而且外网下载资源速度慢,切换淘宝源,下载资源非常的快。
npm nrm

如何安装?

so easy!!

npm i nrm -g

如何使用?

查——浏览所有配置的镜像源

这几个是默认的镜像源,还可以添加自己的

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/

切——切换不同的镜像源

use后面直接加别名即可

nrm use taobao

检查一下

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 add 别名 网址

nrm add haha http://haha.com
# add registry haha success

检查一下,在最后面加上了haha的源

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/
#  haha ------- http://haha.com/

删——删除不需要的镜像源

格式:nrm del 别名

nrm del haha
# delete registry haha success

测——可以测试不同镜像源的速度

格式:nrm test 别名
果然淘宝的还是很快的

nrm test taobao
# * taobao - 216ms
nrm test npm
# npm ---- 910ms
nrm test cnpm
# cnpm --- 1906ms
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值