使用nrm管理npm仓库

来源:互联网 发布:历史湿度数据查询 编辑:程序博客网 时间:2024/05/21 06:25

使用nrm管理npm仓库

用npm装包的时候,经常碰到太慢或者npm官网被墙的情况,有时候凑合一下就改一下 “~/.npmrc” 文件,但是经常改来改去也挺麻烦的,于是找到了可以使用nrm来管理npm仓库。

安装

sudo npm install -g nrm

查询仓库

使用 “nrm ls” 查看所有仓库

$ nrm ls* npm ---- https://registry.npmjs.org/  cnpm --- http://r.cnpmjs.org/  taobao - https://registry.npm.taobao.org/  nj ----- https://registry.nodejitsu.com/  rednpm - http://registry.mirror.cqupt.edu.cn/  npmMirror  https://skimdb.npmjs.com/registry/  edunpm - http://registry.enpmjs.org/

其中带 “*” 的表示当前正在使用的仓库。

添加删除仓库

使用 add 或 del 可以添加或删除仓库。比如:

$ nrm add myrepos ...$ nrm del myrepos

切换仓库

使用 use 来选择当前使用那个仓库。比如:

$ nrm use taobao...$ nrm ls  npm ---- https://registry.npmjs.org/  cnpm --- http://r.cnpmjs.org/* taobao - https://registry.npm.taobao.org/  nj ----- https://registry.nodejitsu.com/  rednpm - http://registry.mirror.cqupt.edu.cn/  npmMirror  https://skimdb.npmjs.com/registry/  edunpm - http://registry.enpmjs.org
原创粉丝点击