Add archived/electron-bundled-chromium-dll-fix

This commit is contained in:
2026-07-10 16:10:28 +08:00
parent 04e2f37c6a
commit 7c3b76c1ee
@@ -0,0 +1,44 @@
---
name: electron-bundled-chromium-dll-fix
description: Fix Electron app bundled Chromium failing to launch on Windows due to missing DLLs
version: 1.0
---
# Fix: Bundled Chromium Missing DLLs on Windows
## Problem
Electron apps bundling Chromium (for CDP/browser automation) fail to launch on Windows. The process crashes silently with no error output. Root cause: GPU-related DLLs were removed to reduce installer size, but Chromium requires them even with `--disable-gpu`.
## Missing DLLs
These 3 DLLs must be present alongside `chrome.dll` in the bundled Chromium directory:
- `D3DCompiler_47.dll` (~4.9MB)
- `libEGL.dll` (~494KB)
- `libGLESv2.dll` (~8.2MB)
## Source
Download from Chromium for Windows release (e.g. `https://storage.googleapis.com/chromium-browser-snapshots/Win/<build>/chrome-win.zip`):
1. Find build number from `chrome-win/` directory's `chrome_debug.log` or commit hash
2. Download full zip, extract the 3 DLLs
3. Copy to `resources/chromium/` in the Electron project
## Key Insight
**`--disable-gpu` is NOT sufficient.** Chromium still loads these DLLs at startup for basic rendering pipeline initialization. Without them, the process exits immediately with no stdout/stderr.
## Fix Steps
1. Download matching Chromium version full archive
2. Copy 3 DLLs to bundled chromium directory
3. Remove `--disable-gpu` flag from spawn args (optional — now GPU works properly)
4. Add `diagnoseBrowserSearch()` function that checks: registry paths, known paths, DLL presence
5. Rebuild installer: `npm run build:win`
## Verification
After build, check NSIS installer contains the DLLs:
```bash
7z l dist/atomk-desktop-X.X.X-setup.exe | grep -E "D3DCompiler|libEGL|libGLESv2"
```
## Context
- Project: AtomK-Desktop (hermes-desktop fork)
- Built with electron-builder, NSIS target
- Bundled Chromium path in app: `resources/chromium/`
- Browser search priority: System Edge/Chrome → Known paths → Bundled Chromium