百度360必应搜狗淘宝本站头条
当前位置:网站首页 > 技术分类 > 正文

包管理如何切换源(nrm用法详情和yrm 用法详情)

ztj100 2024-11-17 18:13 51 浏览 0 评论

关键字:npm、nrm、yarn、yrm

混迹IT多年的资深后端开发者及项目管理者,欢迎学术沟通,其他合作

目录

npm镜像源

1、查看当前使用的镜像源

2、修改镜像源

yarn镜像源

1、查看当前使用的镜像源

2、修改镜像源

npm镜像源

因为 npm 默认的源是在国外,我们访问时会比较慢,一般都会使用淘宝的镜像,或者有些有公司自己的镜像,这就涉及到切换源的操作,总结一下这些操作。

1、查看当前使用的镜像源

npm config get registry

2、修改镜像源

方式1:npm命令修改

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

方式2: 第三方工具nrm管理镜像源(推荐)

nrm可以帮助你轻松地添加、删除、查询、切换所有的Yarn Registries

安装 nrm:

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
SUCCESS The registry has been changed to 'taobao'.

新增镜像:

nrm add aliyun http://maven.aliyun.com/nexus/content/groups/public

删除镜像:

nrm del taobao

测试延迟(访问速度):

yrm test aliyun

查看帮助:

$ nrm -h
Usage: cli [options] [command]

Options:
  -V, --version                    output the version number
  -h, --help                       display help for command

Commands:
  ls                               List all the registries
  current [options]                Show current registry name or URL
  use <name>                       Change current registry
  add <name> <url> [home]          Add custom registry
  login [options] <name> [base64]  Set authorize information for a custom registry with a base64 encoded string or username
                                   and password
  set-hosted-repo <name> <repo>    Set hosted npm repository for a custom registry to publish package
  set-scope <scopeName> <url>      Associating a scope with a registry
  del-scope <scopeName>            Remove a scope
  set [options] <name>             Set a custom registry attribute
  rename <name> <newName>          Change custom registry name
  del <name>                       Delete custom registry
  home <name> [browser]            Open the homepage of registry with optional browser
  test [registry]                  Show response time for specific or all registries
  help [command]                   display help for command


yarn镜像源

执行命令时,yarn 默认是去 npm/yarn 官方镜像源(国外)获取资源,所以速度较慢甚至不可用,解决该问题需要修改默认配置为国内镜像。

1、查看当前使用的镜像源

yarn config get registry

2、修改镜像源

方式1:yarn命令修改

yarn config set registry https://registry.npm.taobao.org/

方式2: 第三方工具yrm管理镜像源(推荐)

yrm可以帮助你轻松地添加、删除、查询、切换所有的Yarn Registries

安装 yrm:

npm install -g yrm

列出所有镜像源:

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
  aliyun - http://maven.aliyun.com/nexus/content/groups/public/


切换镜像:

yrm use taobao
   YARN Registry has been set to: https://registry.npm.taobao.org/

   NPM Registry has been set to: https://registry.npm.taobao.org/

新增镜像:

yrm add aliyun http://maven.aliyun.com/nexus/content/groups/public

删除镜像:

yrm del taobao

测试延迟(访问速度):

yrm test aliyun

查看帮助:

yrm -h
Usage: cli [options] [command]

Options:
  -V, --version                output the version number
  -h, --help                   output usage information

Commands:
  ls                           List all the registries
  current                      Show current registry name
  use <registry>               Change registry to registry
  add <registry> <url> [home]  Add one custom registry
  del <registry>               Delete one custom registry
  home <registry> [browser]    Open the homepage of registry with optional browser
  test [registry]              Show response time for specific or all registries
  help                         Print 

相关推荐

再说圆的面积-蒙特卡洛(蒙特卡洛方法求圆周率的matlab程序)

在微积分-圆的面积和周长(1)介绍微积分方法求解圆的面积,本文使用蒙特卡洛方法求解圆面积。...

python编程:如何使用python代码绘制出哪些常见的机器学习图像?

专栏推荐...

python创建分类器小结(pytorch分类数据集创建)

简介:分类是指利用数据的特性将其分成若干类型的过程。监督学习分类器就是用带标记的训练数据建立一个模型,然后对未知数据进行分类。...

matplotlib——绘制散点图(matplotlib散点图颜色和图例)

绘制散点图不同条件(维度)之间的内在关联关系观察数据的离散聚合程度...

python实现实时绘制数据(python如何绘制)

方法一importmatplotlib.pyplotaspltimportnumpyasnpimporttimefrommathimport*plt.ion()#...

简单学Python——matplotlib库3——绘制散点图

前面我们学习了用matplotlib绘制折线图,今天我们学习绘制散点图。其实简单的散点图与折线图的语法基本相同,只是作图函数由plot()变成了scatter()。下面就绘制一个散点图:import...

数据分析-相关性分析可视化(相关性分析数据处理)

前面介绍了相关性分析的原理、流程和常用的皮尔逊相关系数和斯皮尔曼相关系数,具体可以参考...

免费Python机器学习课程一:线性回归算法

学习线性回归的概念并从头开始在python中开发完整的线性回归算法最基本的机器学习算法必须是具有单个变量的线性回归算法。如今,可用的高级机器学习算法,库和技术如此之多,以至于线性回归似乎并不重要。但是...

用Python进行机器学习(2)之逻辑回归

前面介绍了线性回归,本次介绍的是逻辑回归。逻辑回归虽然名字里面带有“回归”两个字,但是它是一种分类算法,通常用于解决二分类问题,比如某个邮件是否是广告邮件,比如某个评价是否为正向的评价。逻辑回归也可以...

【Python机器学习系列】拟合和回归傻傻分不清?一文带你彻底搞懂

一、拟合和回归的区别拟合...

推荐2个十分好用的pandas数据探索分析神器

作者:俊欣来源:关于数据分析与可视化...

向量数据库:解锁大模型记忆的关键!选型指南+实战案例全解析

本文较长,建议点赞收藏,以免遗失。更多AI大模型应用开发学习视频及资料,尽在...

用Python进行机器学习(11)-主成分分析PCA

我们在机器学习中有时候需要处理很多个参数,但是这些参数有时候彼此之间是有着各种关系的,这个时候我们就会想:是否可以找到一种方式来降低参数的个数呢?这就是今天我们要介绍的主成分分析,英文是Princip...

神经网络基础深度解析:从感知机到反向传播

本文较长,建议点赞收藏,以免遗失。更多AI大模型应用开发学习视频及资料,尽在...

Python实现基于机器学习的RFM模型

CDA数据分析师出品作者:CDALevelⅠ持证人岗位:数据分析师行业:大数据...

取消回复欢迎 发表评论: