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 layered diagnostic script
I published a small read-only diagnostic script for this class of Windows setup problems:
GitHub: WiaiKit Windows AI Coding Setup Repair
It now checks the setup by layer:
- Runtime: Node.js, npm, PATH
- Project:
package.json,node_modules - Electron: package folder,
electron.exe, install hook - Native modules:
better-sqlite3, key listeners,node-gyp - Build Tools: Visual Studio C++ toolchain
- Voice stack: Windows audio, WSL, Codex, Claude Code indicators
Run it from the project folder:
powershell -ExecutionPolicy Bypass -File .\wiaikit-windows-ai-coding-setup-check.ps1
Or pass the project path:
powershell -ExecutionPolicy Bypass -File .\wiaikit-windows-ai-coding-setup-check.ps1 -ProjectPath C:\path\to\your\project
The script does not install, delete, or modify files. It prints OK, CHECK, BROKEN, and NEXT ACTION lines so you can stop guessing which layer failed.
Browser version:
Run the free Windows AI coding setup diagnostic
7. My usual recovery order
For this specific error, I would use this order:
- Confirm the folder has
package.json. - Check
node_modules\electron. - Check
node_modules\electron\dist\electron.exe. - Delete only
node_modules\electron. - Run
npm install. - Only then consider a full
node_modulesreinstall. - If native modules fail, inspect
node-gyp, Visual Studio Build Tools, and the exact package.
This avoids the common Windows loop of reinstalling everything without knowing what actually broke.
Related diagnostic page
I also keep the same fix as a shorter checklist here:
Fix Electron failed to install correctly on Windows
The paid WiaiKit repair kit is the longer recovery path after the diagnostic tells you which layer is broken: npm PATH, Electron, node-gyp, Visual Studio Build Tools, native modules, OpenWhispr, Codex, Claude Code, and push-to-talk voice workflows.
For this specific Electron error, start with the free diagnostic above.












