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/
相关推荐
刺客_Andy7 分钟前
React 第五十二节 Router中 useResolvedPath使用详解和注意事项示例
前端·react.js·架构
豆浆94515 分钟前
vue3+qiankun主应用和微应用的路由跳转返回
前端
王将近23 分钟前
Cesium 山洪流体模拟
前端·cesium
小时前端33 分钟前
当循环遇上异步:如何避免 JavaScript 中最常见的性能陷阱?
前端·javascript
Bacon1 小时前
Electron 集成第三方项目
前端
自由日记1 小时前
css学习9
前端·css·学习
拖拉斯旋风1 小时前
你不知道的javascript:深入理解 JavaScript 的 `map` 方法与包装类机制(从基础到大厂面试题)
前端·javascript
over6971 小时前
《JavaScript的"魔法"揭秘:为什么基本类型也能调用方法?》
前端·javascript·面试
该用户已不存在1 小时前
AI编程工具大盘点,哪个最适合你
前端·人工智能·后端