设置镜像服务器信息
国内用户使用npm安装软件常常会失败,此处使用淘宝镜像
//设置环境变量
export ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/
安装指定版本
安装前需要确认https://npm.taobao.org/mirrors/electron/上存在对应的版本
//安装指定版本,16.0.6为版本号
npm install electron@16.0.6
设置淘宝源
npm install -g cnpm --registry=https://registry.npmmirror.com
npm config set registry https://registry.npm.taobao.org/
npm config get registry //检查是否更换成功
恢复默认来源
npm config set registry https://registry.npmjs.org/