npm pnpm yarn 设置国内镜像

国内镜像

常用的国内镜像:

淘宝镜像 https://registry.npmmirror.com

腾讯云镜像​​ https://mirrors.cloud.tencent.com/npm/

华为云镜像​​ https://repo.huaweicloud.com/repository/npm/

CNPM(阿里系) ​​ https://r.cnpmjs.org/

清华大学镜像​​ https://mirrors.tuna.tsinghua.edu.cn/help/npm/

npm

bash 复制代码
# 查询当前使用的镜像源
npm get registry

# 设置为淘宝镜像源
npm config set registry https://registry.npmmirror.com/

# 还原为官方镜像源
npm config set registry https://registry.npmjs.org/

pnpm

bash 复制代码
# 查询当前使用的镜像源
pnpm get registry

# 设置为淘宝镜像源
pnpm config set registry https://registry.npmmirror.com/

# 还原为官方镜像源
pnpm config set registry https://registry.npmjs.org/

yarn

bash 复制代码
# 查询当前使用的镜像源
yarn config get registry

# 设置为淘宝镜像源
yarn config set registry https://registry.npmmirror.com/

# 还原为官方镜像源
yarn config set registry https://registry.yarnpkg.com/

临时指定镜像

bash 复制代码
npm --registry https://registry.npmjs.org/ install <package-name>
pnpm --registry https://registry.npmjs.org/ add <package-name>
yarn add <package-name> --registry=https://registry.yarnpkg.com/
相关推荐
小林学习编程3 分钟前
Springboot + vue + uni-app小程序web端全套家具商场
前端·vue.js·spring boot
柳鲲鹏4 分钟前
WINDOWS最快布署WEB服务器:apache2
服务器·前端·windows
GDAL30 分钟前
Node.js v22.5+ 官方 SQLite 模块全解析:从入门到实战
数据库·sqlite·node.js
weixin-a153003083161 小时前
【playwright篇】教程(十七)[html元素知识]
java·前端·html
ai小鬼头2 小时前
AIStarter最新版怎么卸载AI项目?一键删除操作指南(附路径设置技巧)
前端·后端·github
一只叫煤球的猫2 小时前
普通程序员,从开发到管理岗,为什么我越升职越痛苦?
前端·后端·全栈
vvilkim2 小时前
Electron 自动更新机制详解:实现无缝应用升级
前端·javascript·electron
vvilkim2 小时前
Electron 应用中的内容安全策略 (CSP) 全面指南
前端·javascript·electron
aha-凯心3 小时前
vben 之 axios 封装
前端·javascript·学习
遗憾随她而去.3 小时前
uniapp 中使用路由导航守卫,进行登录鉴权
前端·uni-app