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

相关推荐
by__csdn几秒前
JavaScript性能优化实战:异步与延迟加载全方位攻略
开发语言·前端·javascript·vue.js·react.js·typescript·ecmascript
牛三金2 分钟前
魔改-隐语PSI通信,支持外部通信自定义
服务器·前端·算法
杨超越luckly3 分钟前
HTML应用指南:利用GET请求获取全国瑞思教育门店位置信息
前端·python·arcgis·html·门店数据
尘缘浮梦5 分钟前
chrome英文翻译插件
前端·chrome
HIT_Weston6 分钟前
58、【Ubuntu】【Gitlab】拉出内网 Web 服务:Gitlab 配置审视(二)
前端·ubuntu·gitlab
doupoa9 分钟前
VitePressv2.0 + TailwindCSSv4.1 集成方案
typescript·前端框架·json·html5·postcss
这是个栗子11 分钟前
【问题解决】Vue2 与 Vue3项目中 Node.js 版本选择
前端·node.js·nvm
222you12 分钟前
SpringBeanFactory
java·服务器·前端
苏打水com12 分钟前
第十一篇:Day31-33 前端安全与性能监控——从“能用”到“安全可靠”(对标职场“系统稳定性”需求)
前端·javascript·css·vue.js·html
fpl111614 分钟前
npm :无法加载文件 D:\...\nodejs\npm.ps1,因为在此系统上禁止运行脚本
前端·vscode·npm·node.js·命令模式