If you are on Windows and an Electron app stops with this error:
Electron failed to install correctly, please delete node_modules/electron and try installing again
the important detail is usually this:
node_modules/electron can exist while the actual Electron binary is missing.
So a blind npm install retry is not always enough. First check whether the package folder exists and whether electron.exe was actually downloaded.
1. Confirm you are in the project folder
Open PowerShell in the project folder and run:
Get-Location
Test-Path .\package.json
Test-Path .\node_modules\electron
You want:
True
True
for package.json and node_modules\electron.
If package.json is False, you are in the wrong folder. Move to the app folder first.
2. Check the actual Electron binary
Now check the binary:
Test-Path .\node_modules\electron\dist\electron.exe
If this returns False, Electron's package directory exists, but the install hook or binary download did not complete.
That is the state that often triggers:
Electron failed to install correctly
3. Try the targeted repair first
Before deleting all node_modules, try the smaller fix:
Remove-Item -Recurse -Force .\node_modules\electron
npm install
Then check again:
Test-Path .\node_modules\electron\dist\electron.exe
If it returns True, retry your app:
npm run dev
4. If Electron still does not install, check Node and npm
Run:
node -v
npm -v
where node
where npm
On Windows, a fresh Node.js install can update PATH, but the old PowerShell window may not see the change yet.
If node works but npm does not, close PowerShell and open a new one before reinstalling anything.
5. If native modules are involved, do not guess
Electron apps often include native packages such as:
better-sqlite3node-gyp- Windows key listeners
- SQLite bindings
Those packages can require prebuilt binaries or local build tools.
Check what is actually present:
npm ls better-sqlite3
npm ls node-gyp
If the project needs a local build, Windows may need Visual Studio Build Tools. But do not install the whole toolchain blindly. First confirm the package that is failing and whether a prebuilt binary exists for your Node/Electron version.
6. Free diagnostic script
I published a small read-only diagnostic script for this class of Windows setup problems:
The paid WiaiKit repair kit is for the longer Windows AI coding setup path: npm PATH, Electron, node-gyp, Visual Studio Build Tools, native modules, OpenWhispr, Codex, Claude Code, and push-to-talk voice workflows.
But for this specific Electron error, start with the free checks above.
SOCIAL SHARE CARD GENERATOR