配置淘宝镜像
淘宝镜像地址: https://registry.npmmirror.com/
命令行配置
npm config set registry https://registry.npmmirror.com/
使用 nrm 配置
- 使用 npm 全局安装 nrm 包管理器
npm i -g nrm
- 使用
nrm ls
查看镜像源
PS C:\Users\Hayden> nrm lsnpm ---------- 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/
- 使用
nrm use taobao
切换镜像源
PS C:\Users\Hayden> nrm use taobao Registry has been set to: https://registry.npmmirror.com/
- 使用
npm config get registry
查看当前镜像源
PS C:\Users\Hayden> npm config get registryhttps://registry.npmmirror.com/
nrm 其他命令
- 添加源, 表示源名称, 表示源地址。
nrm add
- 删除源
nrm del
- 测试源的响应时间
nrm test
其他
- 若要修改 yarn 镜像源配置,可以通过
获取当前源 yarn config get registry 配置源 为源地址 yarn config set registry
- 常见镜像源
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/