指点成金-最美分享吧

登录

nrm安装(NPM源管理器)

佚名 举报

篇首语:本文由小编为大家整理,主要介绍了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 nrmnpm WARN deprecated har-validator@5.1.5: this library is no longer supportednpm 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/3142added 58 packages, and audited 316 packages in 10s13 packages are looking for funding  run `npm fund` for details4 vulnerabilities (3 moderate, 1 high)To address issues that do not require attention, run:  npm audit fixTo address all issues (including breaking changes), run:  npm audit fix --forceRun `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

以上是关于nrm安装(NPM源管理器)的主要内容,如果未能解决你的问题,请参考以下文章