一.通过命令配置
- 命令 ``` npm config set registry https://registry.npmmirror.com
还原
npm config set registry http://registry.npmjs.org
2. 验证命令
npm config get registry
二、通过使用cnpm安装
1. 安装cnpm
npm install -g cnpm —registry=https://registry.npmmirror.com
2. 使用cnpm
cnpm install xxx
三、electron镜像
npm config set registry=https://registry.npmmirror.com npm config set disturl=https://registry.npmmirror.com/-/binary/node npm config set electron_mirror=https://registry.npmmirror.com/-/binary/electron/v npm config set electron_builder_binaries_mirror=https://registry.npmmirror.com/-/binary/electron-builder-binaries/ ```