外观
01_npm + nrm + yarn + pnpm
01_npm
01_npm 设置淘宝镜像
bash
# 将 npm 的镜像源设置为 npmmirror
C:\Users\18123\Desktop>npm config set registry https://registry.npmmirror.com/
# 查看 npm 包管理器的仓库地址
C:\Users\18123\Desktop>npm get registry
https://registry.npmmirror.com/
02_nrm
01_nrm 管理 npm 镜像源
bash
# 全局安装 nrm 包管理器, 用于管理 npm 的镜像源
C:\Users\18123\Desktop>npm install -g nrm
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'nrm@2.0.1',
npm WARN EBADENGINE required: { node: '>=18' },
npm WARN EBADENGINE current: { node: 'v16.20.2', npm: '8.19.4' }
npm WARN EBADENGINE }
added 34 packages in 7s
8 packages are looking for funding
run `npm fund` for details
npm notice New major version of npm available! 8.19.4 -> 11.0.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.0.0
npm notice Run npm install -g npm@11.0.0 to update!
# 查看 npm 的镜像列表
C:\Users\18123\Desktop>nrm ls
npm ---------- https://registry.npmjs.org/
yarn --------- https://registry.yarnpkg.com/
tencent ------ https://mirrors.tencent.com/npm/
cnpm --------- https://r.cnpmjs.org/
* taobao ------- https://registry.npmmirror.com/
npmMirror ---- https://skimdb.npmjs.com/registry/
huawei ------- https://repo.huaweicloud.com/repository/npm/
# 使用淘宝镜像源
C:\Users\18123\Desktop>nrm use taobao
SUCCESS The registry has been changed to 'taobao'.