npm、yarn镜像源管理器nrm、yrm

nrm和yrm是npm和yarn的镜像源管理器。它们可以对镜像源进行测速、切换、查看镜像源列表等操作。可以更好的管理npm和yarn的镜像源。例如我想使用腾讯的npm镜像源,则只需要使用nrm use tencent一条命令即可。

安装镜像源管理器

记得全局安装

npm i nrm -g
npm i yrm -g

安装完毕之后,查看版本

npm 源管理器nrm

nrm --version
1.2.5

yarn 源管理器yrm

yrm --version
1.0.6

镜像源列表

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/

yarn 源列表

yrm 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/
  yarn --- https://registry.yarnpkg.com

测速

对镜像源进行测试响应时间,查看网络环境。

nrm test npm 
* npm ------ 944ms

nrm test yarn
yarn ----- 954ms

nrm test tencent
tencent -- 178ms

nrm test cnpm 
cnpm ----- 1202ms

nrm test taobao
taobao --- 182ms

nrm test npmMirror
npmMirror - 1779ms

国内tencent和taobao俩大厂比较快。


yrm test npm
* npm ---- 978ms

yrm test cnpm
cnpm --- 1922ms

yrm test taobao
taobao - 296ms

yrm test rednpm
rednpm - 278ms

yrm test npmMirror
npmMirror  2310ms

切换镜像源

npm 镜像源切换

//切换到腾讯npm镜像源
nrm use tencent
Registry has been set to: https://mirrors.cloud.tencent.com/npm/

//查看npm镜像源
npm config get registry
https://mirrors.cloud.tencent.com/npm/

yarn镜像源切换

//切换镜像源
C:\Users\Administrator>yrm use npm
   YARN Registry has been set to: https://registry.npmjs.org/
                         verb config Skipping project config: C:\Users\Administrator/.npmrc. (matches userconfig)
   NPM Registry has been set to: https://registry.npmjs.org/

// 查看yarn镜像源
C:\Users\Administrator>yarn config get registry
https://registry.npmjs.org/
 

posted on   zhangzongshan  阅读(605)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· AI与.NET技术实操系列(六):基于图像分类模型对图像进行分类
历史上的今天:
2021-05-09 Navicat Premium 15.0.26 强大的数据库管理工具(Big Sur 可用)
2019-05-09 jsPlumb.jsAPI阅读笔记(官方文档翻译)
2017-05-09 Linux vi/vim

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示