nrm安装(NPM源管理器)

1、什么是nrm

nrm 是一个 npm 源管理器,允许你快速地在 npm源间切换。

npm默认情况下是使用npm官方源(使用命令可以查看),一般我们都会用淘宝npm源:

# 设置淘宝源
npm set registry https://registry.npm.taobao.org/

# 查看源
npm config ls

这样切换不是很方便,同时只能配置一个源,如果我们需要配置多个源,按需切换就需要nrm了。

2、nrm安装

npm install -g nrm

实际安装

>npm install -g nrm
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

added 58 packages, and audited 316 packages in 10s

13 packages are looking for funding
  run `npm fund` for details

4 vulnerabilities (3 moderate, 1 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

C:\Users\Administrator>

3、nrm使用

1、查看可选源

星号代表当前使用源

nrm ls

  npm ---------- https://registry.npmjs.org/
  yarn --------- https://registry.yarnpkg.com/
  tencent ------ https://mirrors.cloud.tencent.com/npm/
  cnpm --------- https://r.cnpmjs.org/
  taobao ------- https://registry.npmmirror.com/
  npmMirror ---- https://skimdb.npmjs.com/registry/

2、查看当前源

nrm current

3、切换源

nrm use <registry>

4、添加源

nrm add <registry> <url>

其中,registry为源名,url为源地址。

比如:添加一个公司私有的npm源,源地址为:http://172.23.1.222:8081/repository/npm-public/,源名为tsnpm(随意取)。

nrm add cpm http://172.23.1.222:8081/repository/npm-public/

5、删除源

nrm del <registry>

其中,registry为源名。

比如:删除刚才添加的cpm源

nrm del tsnpm

6、测试源速度

nrm test <registry>

其中,registry为源名。

比如:测试官方源和淘宝源的响应时间

nrm test npm
  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值