npm、pnpm、yarn镜像源设置

以下为 npm 镜像

npm 查询当前镜像

bash 复制代码
npm get registry

npm 设置为淘宝镜像

淘宝镜像源一(推荐)

bash 复制代码
npm config set registry https://registry.npmmirror.com/

淘宝镜像源二

bash 复制代码
npm config set registry http://registry.npm.taobao.org/

npm 设置为官方默认镜像

bash 复制代码
npm config set registry https://registry.npmjs.org/

以下为 pnpm 镜像

npm 安装 pnpm

bash 复制代码
npm install -g pnpm

查看是否安装成功

bash 复制代码
pnpm -v

查看当前镜像

bash 复制代码
pnpm config get registry

设为淘宝镜像

淘宝镜像源一(推荐)

bash 复制代码
pnpm config set registry https://registry.npmmirror.com/

淘宝镜像源二

bash 复制代码
pnpm config set registry http://registry.npm.taobao.org/

设为官方默认镜像

bash 复制代码
pnpm config set registry https://registry.npmjs.org

以下为 yarn 镜像

npm 安装 yarn

bash 复制代码
npm install -g yarn

npm 卸载 yarn

bash 复制代码
npm uninstall -g yarn

查看是否安装/卸载成功

bash 复制代码
yarn -v

查询当前镜像

bash 复制代码
yarn config get registry

设置为淘宝镜像

淘宝镜像源一(推荐)

bash 复制代码
yarn config set registry https://registry.npmmirror.com/

淘宝镜像源二

bash 复制代码
yarn config set registry http://registry.npm.taobao.org/

设置为官方默认镜像

bash 复制代码
yarn config set registry https://registry.yarnpkg.com/

错误提示

① 有时候会遇到以下报错,可能是因为镜像问题(官方默认镜像有时访问不了)

info There appears to be trouble with your network connection.

Retrying...

② 当 npm install 时遇到报错 ERESOLVE unable to resolve dependency tree 的问题

方案一:版本降级(原版本是 16.20.1,降级为 14.21.3)

方案二:npm install -f [带上 --force 参数(简写 -f)告诉 npm 强制安装]

相关推荐
章豪Mrrey nical1 天前
前后端分离工作详解Detailed Explanation of Frontend-Backend Separation Work
后端·前端框架·状态模式
hh随便起个名1 天前
力扣二叉树的三种遍历
javascript·数据结构·算法·leetcode
我是小路路呀1 天前
element级联选择器:已选中一个二级节点,随后又点击了一个一级节点(仅浏览,未确认选择),此时下拉框失去焦点并关闭
javascript·vue.js·elementui
程序员爱钓鱼1 天前
Node.js 编程实战:文件读写操作
前端·后端·node.js
PineappleCoder1 天前
工程化必备!SVG 雪碧图的最佳实践:ID 引用 + 缓存友好,无需手动算坐标
前端·性能优化
JIngJaneIL1 天前
基于springboot + vue古城景区管理系统(源码+数据库+文档)
java·开发语言·前端·数据库·vue.js·spring boot·后端
敲敲了个代码1 天前
隐式类型转换:哈基米 == 猫 ? true :false
开发语言·前端·javascript·学习·面试·web
澄江静如练_1 天前
列表渲染(v-for)
前端·javascript·vue.js
JustHappy1 天前
「chrome extensions🛠️」我写了一个超级简单的浏览器插件Vue开发模板
前端·javascript·github