直接上命令
- 切换内部源
// 长期使用
npm config --global set registry http://xx.xx.xx.xx:xxxx/xx/npm/
// 检查是否换源成功
npm config get registry
// 查看 npm 配置
npm config list
// 如果命令行修改失败 - 手动修改配置
c:/用户/user/.npmrc 文件 --> 打开修改 registry=http://172.xxx
- 切换淘宝镜像
// 方式一 - 同步安装使用 cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
// 方式二 - 单次使用
npm install --registry=https://registry.npm.taobao.org
- 还原 npm 源
npm config set registry https://registry.npmjs.org/