avatar
童琦杰
向死而生
githubmusic
2019-04-20编辑

Electron - 安装缓慢的问题

方法一:设置环境变量

bash
// for windows
set ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/
// for linux
export ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/

方法二:修改默认URL

bash
vim node_modules/electron-download/lib/index.js

https://github.com/electron/electron/releases/download/v更换为https://npm.taobao.org/mirrors/electron/

javascript
{
    key: 'baseUrl',
    get: function get() {
      return process.env.NPM_CONFIG_ELECTRON_MIRROR || process.env.npm_config_electron_mirror || process.env.ELECTRON_MIRROR || this.opts.mirror || 'https://npm.taobao.org/mirrors/electron/';
}