2021-12-31npm、yarn改镜像地址

author author     2023-03-09     371

关键词:

参考技术A npm默认仓库地址: https://registry.npmjs.org/

yarn默认仓库地址: https://registry.yarnpkg.com

yarn和npm镜像是一致的,只不过yarn优化了npm的操作而已,所以当npm更换了源地址,使用yarn add安装package时,如果npm源地址里不含此package的镜像,则也会直接报错:

npm、yarn查看源地址

npm configgetregistryyarn configgetregistrynpm config ls

pm、yarn更换源地址

npm config set registry<源地址url>//更换npm镜像源地址yarn config set registry<源地址url>//更换yarn镜像源地址npm config set<某插件><源地址url>//仅更改某插件的npm源地址yarn config set<某插件><源地址url>//仅更改某插件的yarn源地址

镜像源地址部分

npm---https://registry.npmjs.org/npm---https://registry.npm.taobao.org/yarn---https://registry.yarnpkg.com/yarn---https://registry.npm.taobao.org/cnpm---https://r.cnpmjs.org/taobao---https://registry.npm.taobao.org/nj---https://registry.nodejitsu.com/rednpm---https://registry.mirror.cqupt.edu.cn/npmMirror---https://skimdb.npmjs.com/registry/deunpm---http://registry.enpmjs.org/

使用nrm源管理工具管理npm及yarn源##

nrm是yarn及npm的源管理工具,类似于:nvm是node的版本管理工具。

1. 安装nrm:

npm install-g nrm//npm全局安装nrmyarnaddnrm-g//yarn全局安装nrm

2. nrm使用

查看可选源

nrm ls

查看当前源

nrm current

切换源

nrmuse<源名(非url,如taobao)>//使用源的名称切换源,源的名称即为nrm ls中列出的键值对(源名:url)中的key

添加源

nrm add<源名><源地址url>

删除源

nrmdel<源名>

测试源速度

nrm test <源名>

链接:https://www.jianshu.com/p/b4b89d6a5f2c

npm和yarn更改为淘宝镜像(代码片段)

查看registry#npm命令npmconfiggetregistry#yarn命令yarnconfiggetregistry修改为淘宝镜像#npm命令npmconfigsetregistryhttp://registry.npm.taobao.org/#yarn命令yarnconfigsetregistryhttp://registry.npm.taobao.org/修改为原镜像#npm命令n 查看详情

安装使用yarn,使用国内镜像加速npm和yarn

安装yarnhttps://yarnpkg.com/lang/zh-hans/docs/install/使用国内镜像加速npm和yarn1.npmconfigsetregistry=https://registry.npm.taobao.org2.yarnconfigsetregistryhttps://registry.npm.taobao.org3.下载cnpm:npminstall-gcnp 查看详情

npmyarn简单使用记录

...用为主 npm查看仓库地址:npmconfiggetregistrynpm设置淘宝镜像:npmconfigsetregistryhttp://registry.npm.taobao.org/npm还原仓库地址:npmconfigsetregistryhttps://registry.npmjs.org/yarn查看仓库地址:yarnconfiggetregistryyarn设置淘宝镜像:yarnconfigsetregistryhtt... 查看详情

yarn(npm)切换设置镜像源

设置镜像源1、查看一下当前源yarnconfiggetregistry2、切换为淘宝源yarnconfigsetregistryhttps://registry.npm.taobao.org3、或者切换为自带的yarnconfigsetregistryhttps://registry.yarnpkg.com   查看详情

查看npm和yarn的镜像源和配置淘宝镜像源(代码片段)

1、查看 #npm:npmconfiggetregistry#yarn:yarnconfiggetregistry 2、设置#(命令行)设置淘宝源#npm:npmconfigsetregistryhttps://registry.npm.taobao.org#yarnyarnconfigsetregistryhttps://registry.npm.taobao.org--gl 查看详情

npm和yarn更改为淘宝镜像

npm下载cnpm用cnpminstall //安装yarncnpminstallyarn-g  yarn更换下载源//查看下载源yarnconfiggetregistry//更换为淘宝源yarnconfigsetregistry https://registry.npm.taobao.org//初始化项目yarninit-y//安装webpackyarna 查看详情

npm和yarn的淘宝镜像添加(代码片段)

npmconfigsetregistryhttps://registry.npm.taobao.orgnpmconfigsetdisturlhttps://npm.taobao.org/distnpmconfigsetelectron_mirrorhttps://npm.taobao.org/mirrors/electron/npmconfigsetsass_binary_sitehttps:// 查看详情

yarn(代码片段)

配置yarn为淘宝镜像yarnconfiggetregistry#查看当前设置的镜像源地址yarnconfigsetregistry‘https://registry.npm.taobao.org‘  查看详情

yarn&&npm设置镜像源(代码片段)

yarnyarnconfigsetregistryhttps://registry.npm.taobao.org--globalyarnconfigsetdisturlhttps://npm.taobao.org/dist--globalnpmnpmconfigsetregistryhttps://registry.npm.taobao.org--globalnpmconfigsetdisturlhttps://npm.taobao.org/dist--global 查看详情

yarn国内加速,修改镜像源

参考技术A执行yarn各种命令的时候,默认是去npm/yarn官方镜像源获取需要安装的具体软件信息以下命令查看当前使用的镜像源yrmYARNregistrymanageryrm不仅可以快速切换镜像源,还可以测试自己网络访问不同源的速度mac下报错安装cnpm然... 查看详情

如何在 PHP docker 镜像上安装 yarn 和 npm(symfony 4 项目)

】如何在PHPdocker镜像上安装yarn和npm(symfony4项目)【英文标题】:HowtoinstallyarnandnpmonaPHPdockerimage(symfony4project)【发布时间】:2020-10-2219:55:20【问题描述】:我正在做一个symfony4/posgresql项目。我正在使用docker工具箱。我需要在symfony... 查看详情

yarn安装electron提示安装正常却实际没有安装的解决(代码片段)

yarn设置临时镜像yarnsaveexpress--registryhttps://registry.npm.taobao.orgyarn设置永久镜像yarnconfigsetregistryhttps://registry.npm.taobao.orgnpm设置临时镜像npm--registryhttps://registry.npm.taobao.orginstallexpressnpm设置永久镜像npmconfigsetregistryhttps://registry.npm.taobao.... 查看详情

jhipster生成工程(代码片段)

准备1.maven管理2.mysql数据库3.git4.node.js5.yarn6.npm(npm和yarn装一个就行,推荐npm)7.配置npm的registry地址,推荐使用淘宝npm镜像 参考链接:https://www.cnblogs.com/peijyStudy/p/12888085.html8.脚手架安装:8.1安装Yeoman   npminstall 查看详情

npm镜像地址的修改或切换

...npm的配置文件npmconfigsetregistryhttp://registry.npm.taobao.org此处镜像改为淘宝镜像方法三:使用nrm管理registry地址安装nrmnpminstall-gnrm查看镜像列表nrmls切换镜像nrmusetaobao在nrm添加自己的镜像地址nrmaddr_namer_url(r_name镜像名字,r_url镜像地... 查看详情

yarn安装node-sass报错问题(代码片段)

...e-sass安装的时候编译报错。解决方法:第一步:配置淘宝镜像yarnconfigsetregistryhttps://registry.npm.taobao.org-g第二步:配置下node-sass的二进制包镜像地址yarnconfigsetsass_binary_sitehttp://cdn.npm.ta 查看详情

国内npm镜像使用

淘宝npm镜像搜索地址:http://npm.taobao.org/registry地址:http://registry.npm.taobao.org/cnpmjs镜像搜索地址:http://cnpmjs.org/registry地址:http://r.cnpmjs.org/1.临时使用npm--registryhttps://registry.npm.taobao.orginstallexpre 查看详情

前端npm或yarn装包踩坑——安装超时失败,设置镜像源不生效(代码片段)

...m或yarn进行安装依赖包时,无响应超时,随即设置镜像源指向淘宝镜像,但始终不生效。问题原因:无响应——网络等原因,导致npmrc装包失败;设置镜像不生效——项目中的.npmrc文件已经配置镜像源路径&#... 查看详情

npm的nrm命令使用--设置镜像地址(代码片段)

npm下载会很慢,因为npm默认从国外下载资源,建议修改npm镜像源地址1.运行npminrm-g全局安装nrm包;2.使用nrmls查看当前所有可用的镜像源地址以及当前所使用的镜像源地址;3.使用nrmusetaobao切换镜像源地址  查看详情