阅读:80回复:1
npm、yarn、pnpm 设置最新国内镜像源(附官方镜像源和最新阿里源),以及 nrm 的使用教程【2025】
npm
查询源 npm get registry 设置源 # 国内 淘宝 镜像源: npm config set registry https://registry.npmmirror.com/ # 官方镜像源: npm config set registry https://registry.npmjs.org/ pnpm 查询源 pnpm get registry 设置源 # 国内 淘宝 镜像源: pnpm config set registry https://registry.npmmirror.com/ # 官方镜像源: pnpm config set registry https://registry.npmjs.org/ yarn 查询源 yarn config get registry 设置源 # 国内 淘宝 镜像源: yarn config set registry https://registry.npmmirror.com/ # 官方镜像源: yarn config set registry https://registry.yarnpkg.com/ 镜像源集合: { "npm": "https://registry.npmjs.org/", "yarn": "https://registry.yarnpkg.com/", "tencent": "https://mirrors.cloud.tencent.com/npm/", "taobao": "https://registry.npmmirror.com/", "cnpm": "https://r.cnpmjs.org/", "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/" } |
|
沙发#
发布于:2025-03-31 17:22
使用 nrm 切换镜像源
安装: npm install nrm -g # or sudo npm install nrm -g 使用: nrm ls ![]() nrm <add | del> <registry-name> [registry url] - 添加或删除镜像源 # 添加源: nrm add testRegistry https://baidu.com/ # 删除源: nrm del testRegistry nrm use <registry-name> - 使用源: nrm use taobao nrm test - 测试所有镜像源的速度: npm cache clean --force https://ksh7.com/posts/npm-registry/index.html#%E8%AE%BE%E7%BD%AE%E5%90%8E-yarn-%E4%B8%8D%E7%94%9F%E6%95%88%EF%BC%9F |
|