惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
Check Point Blog
有赞技术团队
有赞技术团队
博客园 - 三生石上(FineUI控件)
博客园_首页
博客园 - 【当耐特】
WordPress大学
WordPress大学
月光博客
月光博客
博客园 - 叶小钗
S
SegmentFault 最新的问题
雷峰网
雷峰网
H
Help Net Security
宝玉的分享
宝玉的分享
A
About on SuperTechFans
IT之家
IT之家
J
Java Code Geeks
Hugging Face - Blog
Hugging Face - Blog
D
DataBreaches.Net
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 聂微东
T
The Blog of Author Tim Ferriss
B
Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Y
Y Combinator Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Fix Electron failed to install correctly on Windows
Tony Stark · 2026-06-23 · via DEV Community

Tony Stark

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-sqlite3
  • node-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:

GitHub: WiaiKit Windows AI Coding Setup Repair

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 only checks local state:

  • Node.js visibility
  • npm visibility
  • project folder
  • Electron package folder
  • Electron binary
  • common native-module folders
  • Visual Studio C++ Build Tools via vswhere

7. My usual recovery order

For this specific error, I would use this order:

  1. Confirm the folder has package.json.
  2. Check node_modules\electron.
  3. Check node_modules\electron\dist\electron.exe.
  4. Delete only node_modules\electron.
  5. Run npm install.
  6. Only then consider a full node_modules reinstall.
  7. 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 page

I also wrote the same fix as a shorter checklist here:

Fix Electron failed to install correctly on Windows

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.