Installing Electron manually for electron-builder

This article tries to resolve an uncommon issue when you encounter the following error and it cannot be resolved automatically, e.g. behind proxy, etc.:

Error: Electron failed to install correctly, please delete node_modules/electron and try installing again

Download the right version (with consideration of package.json) of Electron from

Unpack the downloaded Electron and put all files under node_modules/electron/dist.

Create path.txt file under node_modules/electron with the following content:

  • Windows: electron.exe
  • Linux: electron
  • macOS:

Note: Make sure there is no whitespace characters (including a newline character) after the filename. This is a problem that I struggled for minutes and hours.