安装源管理器nrm
bash
sudo npm install -g nrm
#macOS
npm install -g nrm
#Windows以管理员身份运行
安装完毕之后通过以下命令可以切换你想要的源
bash
nrm ls
#查看源列表
* 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/
huawei ------- https://repo.huaweicloud.com/repository/npm/
nrm use tencent
#切换腾讯源
SUCCESS The registry has been changed to 'tencent'.
#源切换成功