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/
相关推荐
牧羊人_myr21 小时前
Ajax 技术详解
前端
浩男孩21 小时前
🍀封装个 Button 组件,使用 vitest 来测试一下
前端
蓝银草同学21 小时前
阿里 Iconfont 项目丢失?手把手教你将已引用的 SVG 图标下载到本地
前端·icon
布列瑟农的星空21 小时前
重学React —— React事件机制 vs 浏览器事件机制
前端
一小池勺21 小时前
CommonJS
前端·面试
孙牛牛21 小时前
实战分享:一招解决嵌套依赖版本失控问题,以 undici 为例
前端
用户52709648744901 天前
Git 最佳实践
前端
星秀日1 天前
JavaWeb--Ajax
前端·javascript·ajax
4_0_41 天前
全栈视角:从零构建一个现代化的 Todo 应用
前端·node.js