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.:
1 | 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 https://github.com/electron/electron/releases
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:
Electron.app/Contents/MacOS/Electron
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.