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 强制安装

相关推荐
kyriewen21 小时前
我筛了 1400 个 Claude Code Skills,留下 5 个天天在用的
前端·ai编程·claude
JNX_SEMI21 小时前
AT2401C 2.4GHz 全集成射频前端单芯片技术解析
前端·单片机·嵌入式硬件·物联网·硬件工程
anOnion1 天前
Agentic 前端开发之 实时显示 AI Agent 终端输出
前端·javascript·人工智能
随风一样自由1 天前
【前端领域】2026最新前端领域全梳理(框架/工具/AI/跨端/底层标准/就业趋势)
前端·人工智能·前端框架
这是个栗子1 天前
【前端性能优化】优化数据加载:用 Promise.all 从串行到并行
前端·javascript·性能优化·异步编程·前端优化·promise.all
fei_sun1 天前
黑洞路由(Null Route/空接口路由)
服务器·前端·javascript
大爱一家盟1 天前
告别卡点BGM同质化 2026原创卡点音乐素材下载网站 TOP5 推荐
大数据·前端·人工智能
彦为君1 天前
算法思维与经典智力题
java·前端·redis·算法
aa小小1 天前
localhost 访问异常排查笔记
前端
格子软件1 天前
2026年GEO优化系统源码的分布式状态机深度拆解
java·前端·vue.js·vue·geo