1. 报错
大概率由镜像问题导致
2. 解决
2.1 打开 npm 配置
bash
npm config edit
2.2 添加配置
bash
registry=https://registry.npmmirror.com
electron_mirror=https://cdn.npmmirror.com/binaries/electron/
electron_builder_binaries_mirror=https://npmmirror.com/mirrors/electron-builder-binaries/
2.3 再次安装
bash
npm install --save-dev electron