Markdown
仅自己可见
保存
Preview

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/';
}
Markdown
仅自己可见
保存