npm、yarn、pnpm 设置最新国内镜像源

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/

镜像源集合

json
复制代码
{ "npm": "https://registry.npmjs.org/", "yarn": "https://registry.yarnpkg.com/", "tencent": "https://mirrors.cloud.tencent.com/npm/", "cnpm": "https://r.cnpmjs.org/", "taobao": "https://registry.npmmirror.com/", "npmMirror": "https://skimdb.npmjs.com/registry/", "ali": "https://registry.npm.alibaba-inc.com/", "huawei": "https://mirrors.huaweicloud.com/repository/npm/", "163": "https://mirrors.163.com/npm/", "ustc": "https://mirrors.ustc.edu.cn/", "tsinghua": "https://mirrors.tuna.tsinghua.edu.cn/" }

使用 nrm 切换镜像源

安装

text
复制代码
npm install nrm -g # or sudo npm install nrm -g

使用

text
复制代码
#列出所有的镜像源或查看当前使用的源 nrm ls # 切换源 nrm use # 添加源 nrm add testRegistry https://baidu.com/ # 删除源 nrm del testRegistry
0个评论
点击登录,快来和大家讨论吧~
表情
图片
暂无评论
翌冰之
下载 APP