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/
相关推荐
百锦再25 分钟前
Reactive编程入门:Project Reactor 深度指南
前端·javascript·python·react.js·django·前端框架·reactjs
莲华君27 分钟前
React快速上手:从零到项目实战
前端·reactjs教程
百锦再27 分钟前
React编程高级主题:测试代码
android·前端·javascript·react.js·前端框架·reactjs
易安说AI39 分钟前
Ralph Loop 让Claude无止尽干活的牛马...
前端·后端
失忆爆表症2 小时前
05_UI 组件库集成指南:Shadcn/ui + Tailwind CSS v4
前端·css·ui
小迷糊的学习记录2 小时前
Vuex 与 pinia
前端·javascript·vue.js
发现一只大呆瓜3 小时前
前端性能优化:图片懒加载的三种手写方案
前端·javascript·面试
不爱吃糖的程序媛3 小时前
Flutter 与 OpenHarmony 通信:Flutter Channel 使用指南
前端·javascript·flutter
利刃大大3 小时前
【Vue】Element-Plus快速入门 && Form && Card && Table && Tree && Dialog && Menu
前端·javascript·vue.js·element-plus
NEXT063 小时前
AI 应用工程化实战:使用 LangChain.js 编排 DeepSeek 复杂工作流
前端·javascript·langchain