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/
相关推荐
J***Q2925 小时前
Vue数据可视化
前端·vue.js·信息可视化
ttod_qzstudio6 小时前
深入理解 Vue 3 的 h 函数:构建动态 UI 的利器
前端·vue.js
_大龄7 小时前
前端解析excel
前端·excel
槁***耿7 小时前
JavaScript在Node.js中的事件发射器
开发语言·javascript·node.js
一叶茶7 小时前
移动端平板打开的三种模式。
前端·javascript
前端大卫7 小时前
一文搞懂 Webpack 分包:async、initial 与 all 的区别【附源码】
前端
U***49837 小时前
JavaScript在Node.js中的Strapi
开发语言·javascript·node.js
Want5957 小时前
HTML音乐圣诞树
前端·html
老前端的功夫8 小时前
前端浏览器缓存深度解析:从网络请求到极致性能优化
前端·javascript·网络·缓存·性能优化
Running_slave9 小时前
你应该了解的TCP滑窗
前端·网络协议·tcp/ip