Published on

快速切换node源 nrm

Authors

介绍

nrm NPM registry manager

nrm 可以帮助你在不同的node源中快速切换,包括 npm, cnpm, taobao, nj(nodejitsu),当然你也可以添加自己的源到里面;

安装

npm install -g nrm

使用

  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/

通过上下选择+回车选中; 带 * 的源是当前使用的源

当然你也可以直接 nrm use taobao 来快速的切换到淘宝的镜像源

  • 添加自己的源
nrm add <registry> <url> # 其中registry为源名,url为源的路径。
  • 删除源
nrm del <registry> # 其中registry为源名

结束

基本上就这些基本命令,更多的可以看官网 nrm ;一般在开发中我会选择直接安装 yarn/cnpm/pnpm 等工具, 或者直接使用科学上网来下载依赖包;