原创
nrm的使用
nrm 介绍
nrm 是一个 npm 源管理工具,可以方便的切换 npm 源,并且可以保存多个源供选择。
作为前端开发,你一定使用过 npm 来安装第三方依赖,但由于 npm 默认下载仓库地址为 https://registry.npmjs.org/,它是国外的网站,下载 npm 包的时候,会比较慢,所以需要切换 npm 源。
如果我们需要切换为国内的源,比方说淘宝镜像,那么只需要执行下面的命令即可:
shell
1
npm config set registry https://registry.npmmirror.com/
但是命令太长,如果我需要切换回去呢?又要再来一遍
注意,请使用新的淘宝镜像:https://registry.npmmirror.com/。http://npm.taobao.org 和 http://registry.npm.taobao.org于2022-06-30正式下线
全局安装
shell
1
npm i -g nrm
查看版本
shell
1
nrm -V
查看所有源
shell
123456789
nrm ls
# npm -------- https://registry.npmjs.org/
# yarn ------- https://registry.yarnpkg.com/
# cnpm ------- http://r.cnpmjs.org/
# taobao ----- https://www.npmmirror.com/
# nj --------- https://registry.nodejitsu.com/
# npmMirror -- https://skimdb.npmjs.com/registry/
# edunpm ----- http://registry.enpmjs.org/
设置源
shell
1
nrm use taobao
期待你的捷足先登


