nrm -- npm的镜像源管理工具

516 阅读1分钟

nrm -- npm的镜像源管理工具

nrm(npm registry manager ) npm的镜像源管理工具

关于淘宝镜像,介绍一个镜像源管理工具,可以快速的切换npm的镜像源

  • 全局安装nrm
npm install -g nrm
  • 查看nrm 所有的镜像源地址 nrm ls;带*号的是当前使用源
# 查看所有镜像源地址

nrm ls

  • 切换镜像源 nrm use [registry]

例如切换淘宝源

nrm use taobao

nrm 命令

nrm -h / nrm -help  // 列出nrm的相关命令、信息

nrm -V             // nrm版本

nrm ls             // 列出nrm所有的镜像源地址

nrm current        // 当前使用镜像源

nrm use <registry> // 使用某个镜像源

nrm add <registry> <url> [home]   //增加镜像源;registry镜像源名;url 镜像源地址

nrm del <registry>  // 删除对应的源。

nrm test <registry>  //测试镜像源下载响应时间

npm | yarn | pnpm 设置淘宝镜像:

NPM

查看当前源

npm config get registry

临时修改

npm --registry https://registry.npmmirror.com install any-touch

设置taobao源(替换默认源)

# 替换npm为淘宝镜像

npm config set registry https://registry.npmmirror.com

恢复默认

# 恢复默认

npm config set registry https://registry.npmjs.org

Yarn

查看当前源

yarn config get registry

临时修改

yarn add any-touch@latest --registry= https://registry.npmmirror.com

设置taobao源(替换默认源)

yarn config set registry https://registry.npmmirror.com

恢复默认

yarn config set registry https://registry.npmmirror.com

PNPM

查看源

pnpm get registry 

临时修改

pnpm --registry https://registry.npmmirror.com install any-touch

设置taobao源(替换默认源)

pnpm config set registry https://registry.npmmirror.com

还原

pnpm config set registry https://registry.npmmirror.com