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

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

ztj100 2024-11-17 18:13 32 浏览 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 

相关推荐

Whoosh,纯python编写轻量级搜索工具

引言在许多应用程序中,搜索功能是至关重要的。Whoosh是一个纯Python编写的轻量级搜索引擎库,可以帮助我们快速构建搜索功能。无论是在网站、博客还是本地应用程序中,Whoosh都能提供高效的全文搜...

如何用Python实现二分搜索算法(python二分法查找代码)

如何用Python实现二分搜索算法二分搜索(BinarySearch)是一种高效的查找算法,适用于在有序数组中快速定位目标值。其核心思想是通过不断缩小搜索范围,每次将问题规模减半,时间复杂度为(O...

路径扫描 -- dirsearch(路径查找器怎么使用)

外表干净是尊重别人,内心干净是尊重自己,干净,在今天这个时代,应该是一种极高的赞美和珍贵。。。----网易云热评一、软件介绍Dirsearch是一种命令行工具,可以强制获取web服务器中的目录和文件...

78行Python代码帮你复现微信撤回消息!

来源:悟空智能科技本文约700字,建议阅读5分钟。本文基于python的微信开源库itchat,教你如何收集私聊撤回的信息。...

从零开始学习 Python!2《进阶知识》 Python进阶之路

欢迎来到Python学习的进阶篇章!如果你说已经掌握了基础语法,那么这篇就是你开启高手之路的大门。我们将一起探讨面向对象编程...

白帽黑客如何通过dirsearch脚本工具扫描和收集网站敏感文件

一、背景介绍...

Python之txt数据预定替换word预定义定位标记生成word报告(四)

续接Python之txt数据预定替换word预定义定位标记生成word报告(一)https://mp.toutiao.com/profile_v4/graphic/preview?pgc_id=748...

假期苦短,我用Python!这有个自动回复拜年信息的小程序

...

Python——字符串和正则表达式中的反斜杠(&#39;\&#39;)问题详解

在本篇文章里小编给大家整理的是关于Python字符串和正则表达式中的反斜杠('\')问题以及相关知识点,有需要的朋友们可以学习下。在Python普通字符串中在Python中,我们用'\'来转义某些普通...

Python re模块:正则表达式综合指南

Python...

Python中re模块详解(rem python)

在《...

python之re模块(python re模块sub)

re模块一.re模块的介绍1.什么是正则表达式"定义:正则表达式是一种对字符和特殊字符操作的一种逻辑公式,从特定的字符中,用正则表达字符来过滤的逻辑。(也是一种文本模式;)2、正则表达式可以帮助我们...

MySQL、PostgreSQL、SQL Server 数据库导入导出实操全解

在数字化时代,数据是关键资产,数据库的导入导出操作则是连接数据与应用场景的桥梁。以下是常见数据库导入导出的实用方法及代码,包含更多细节和特殊情况处理,助你应对各种实际场景。一、MySQL数据库...

Zabbix监控系统系列之六:监控 mysql

zabbix监控mysql1、监控规划在创建监控项之前要尽量考虑清楚要监控什么,怎么监控,监控数据如何存储,监控数据如何展现,如何处理报警等。要进行监控的系统规划需要对Zabbix很了解,这里只是...

mysql系列之一文详解Navicat工具的使用(二)

本章内容是系列内容的第二部分,主要介绍Navicat工具的使用。若查看第一部分请见:...

取消回复欢迎 发表评论: