npm原始源
https://registry.npmjs.org/
nrm是什么
nrm 是一个 npm 源管理器,允许你快速地在 npm 源间切换。
全局安装nrm
npm install -g nrm
添加新的源
执行命令 nrm add <registry> <url>,其中 registry为源名,url为源的路径。例如下面添加公司的私有源。
nrm add company http://ownCompany.hurrynpm.cn:2233/
查询源
nrm ls
//输出结果:
/*
npm -------- https://registry.npmjs.org/
yarn ------- https://registry.yarnpkg.com/
cnpm ------- http://r.cnpmjs.org/
taobao ----- https://registry.npmmirror.com/
nj --------- https://registry.nodejitsu.com/
npmMirror -- https://skimdb.npmjs.com/registry/
edunpm ----- http://registry.enpmjs.org/
company ---- http://ownCompany.hurrynpm.cn:2233/
*/
nrm切换源,如(淘宝源)
nrm use taobao
测试源响应时间
nrm test <registry>
//例如: nrm test taobao
删除源
nrm del <registry>
//例如:nrm del company
拓展:
改变全局的注册,设置淘宝源
npm config set registry https://registry.npmmirror.com
yarn config set registry https://registry.npmmirror.com
pnpm config set registry https://registry.npmmirror.com
cnpm config set registry https://registry.npmmirror.com
查看当前源
npm config get registry
yarn config get registry
pnpm config get registry
cnpm config get registry
在命令行里切换源并且安装依赖包
npm --registry https://registry.npmmirror.com install [name]
全局安装cnpm并且指定源
npm install -g cnpm --registry=https://registry.npmmirror.com