Skip to content

中国镜像地址收藏

前端相关

NPM

淘宝 NPM 镜像

bash
# 淘宝 NPM 镜像
npm config set registry https://registry.npmmirror.com

# corepack 时设置环境变量
# export COREPACK_NPM_REGISTRY=https://registry.npmmirror.com
echo "export COREPACK_NPM_REGISTRY=https://registry.npmmirror.com" >> ~/.zshrc

# fnm 配置 node 的镜像源
# export FNM_NODE_DIST_MIRROR=https://mirrors.ustc.edu.cn/node/
# export FNM_NODE_DIST_MIRROR=https://mirrors.tuna.tsinghua.edu.cn/nodejs-release/
echo "export FNM_NODE_DIST_MIRROR=https://mirrors.ustc.edu.cn/node/" >> ~/.zshrc

# pnpm 配置
pnpm config set registry https://registry.npmmirror.com

其它源

bash
# 阿里云: 
npm config set registry https://npm.aliyun.com

# 腾讯云: 
npm config set registry https://mirrors.cloud.tencent.com/npm/

# 华为云: 
npm config set registry https://mirrors.huaweicloud.com/repository/npm/

# 清华大学: 
npm config set registry https://mirrors.tuna.tsinghua.edu.cn/npm/

官方源

bash
# 查看是什么源
npm config get registry

npm config set registry https://registry.npmjs.org/