1.配置全局的 国内npm镜像地址:
npm get registry
npm config set registry https://registry.npmmirror.com
可以通过 https://registry.npmmirror.com/binary.html 查看都有哪些二进制包
2.一个个配置config set
npm config set registry https://registry.npmmirror.com/ npm config set electron_mirror https://npmmirror.com/mirrors/electron/ npm config set electron_builder_binaries_mirror https://npmmirror.com/mirrors/electron-builder-binaries/ npm config set sqlite3_binary_host_mirror https://npmmirror.com/mirrors/sqlite3/ # sass_binary_site=https://npmmirror.com/mirrors/node-sass/ npm config set chromedriver_cdnurl https://npmmirror.com/mirrors/chromedriver/ npm config set operadriver_cdnurl https://npmmirror.com/mirrors/operadriver/ npm config set fse_binary_host_mirror https://npmmirror.com/mirrors/fsevents/
3.再安装指定版本Electron
npm install electron@16.0.6
成功。
如果不配置上面那些,各种socket hang up, certs errror 都来了
备注:
D:\yansc\CODE-TEST\Electron>nvm list
18.20.2
* 16.14.0 (Currently using 64-bit executable)
14.21.3
D:\yansc\CODE-TEST\Electron>