avatar
童琦杰
Apr 20, 2019Technology

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/';
}
© 2015-2022 tongqijie.com 版权所有沪ICP备17000682号