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

相关推荐
半点寒12W1 小时前
微信小程序实现路由拦截的方法
前端
某公司摸鱼前端2 小时前
uniapp socket 封装 (可拿去直接用)
前端·javascript·websocket·uni-app
要加油哦~2 小时前
vue | 插件 | 移动文件的插件 —— move-file-cli 插件 的安装与使用
前端·javascript·vue.js
小林学习编程2 小时前
Springboot + vue + uni-app小程序web端全套家具商场
前端·vue.js·spring boot
柳鲲鹏2 小时前
WINDOWS最快布署WEB服务器:apache2
服务器·前端·windows
GDAL3 小时前
Node.js v22.5+ 官方 SQLite 模块全解析:从入门到实战
数据库·sqlite·node.js
weixin-a153003083163 小时前
【playwright篇】教程(十七)[html元素知识]
java·前端·html
ai小鬼头4 小时前
AIStarter最新版怎么卸载AI项目?一键删除操作指南(附路径设置技巧)
前端·后端·github
wen's4 小时前
React Native 0.79.4 中 [RCTView setColor:] 崩溃问题完整解决方案
javascript·react native·react.js
一只叫煤球的猫4 小时前
普通程序员,从开发到管理岗,为什么我越升职越痛苦?
前端·后端·全栈