This file will be expanded with real cases from projects.
Context: App window opens but shows nothing – black or white screen.
Typical causes: Wrong loadFile() path, build folder missing from ASAR, TailwindCSS purged styles, corrupted localStorage.
See: electron-black-screen-debug.md for full diagnostic playbook.
Context: Native module fails to compile during install or build.
Typical causes:
- Missing build tools on the system (Python, Visual Studio Build Tools on Windows).
- Node.js version incompatible with the native module version.
- Electron version mismatch (module compiled for wrong Node ABI).
Solution approach:
- Verify build tools are installed:
- Windows:
npm install --global windows-build-tools - macOS:
xcode-select --install
- Windows:
- Check Node.js version compatibility with the module.
- Rebuild for Electron:
npx electron-rebuild
Context: App runs in dev but fails after packaging.
Typical causes:
- Module listed in
devDependenciesinstead ofdependencies. - Dynamic
require()path not resolved by bundler. - File excluded from asar or build configuration.
Solution approach:
- Move the module to
dependenciesinpackage.json. - Check
filesorextraResourcesin electron-builder config. - If dynamic import, use
__dirnamecorrectly with asar paths.
Context: Build fails when processing the app icon.
Typical causes:
.icofile missing required layers (256x256, 48x48, 32x32, 16x16).- Corrupted or incorrectly formatted icon file.
- Wrong file extension or path in config.
Solution approach:
- Regenerate icon with all required sizes (use tools like RealFaviconGenerator or GIMP).
- Verify icon path in
electron-builder.ymlorpackage.json. - Test with a known-good
.icofile.
Context: Build or install fails on Windows due to path length.
Typical causes:
- Deep
node_modulesnesting exceeds 260 character limit. - Project located in a deeply nested folder.
Solution approach:
- Move project to a shorter path (e.g.,
C:\dev\app). - Enable long paths in Windows (requires registry edit or Group Policy).
- Use
npm dedupeto flatten dependency tree.
Context: Build process cannot sign the executable.
Typical causes:
- Certificate file (
.pfx) not found or wrong path. - Certificate password missing or incorrect.
- Certificate expired or not trusted.
Solution approach:
- Verify
CSC_LINKandCSC_KEY_PASSWORDenvironment variables. - Check certificate expiration date.
- Test signing manually with
signtool(Windows) before automated build.
Context: electron-builder fails with Cannot create symbolic link : El cliente no dispone de un privilegio requerido when extracting winCodeSign.
Typical causes:
signAndEditExecutableistrue(default) but Windows user doesn't have symlink privileges- winCodeSign 7z archive contains macOS symlinks that can't be created on Windows
Solution approach:
- Set
"signAndEditExecutable": falseinwinconfig — this skips the sign+edit step entirely - Use
rceditmanually to inject the icon into the .exe after build:rcedit-x64.exe "release/win-unpacked/MyApp.exe" --set-icon "path/to/icon.ico" - Rebuild ONLY the NSIS installer from the patched exe:
npx electron-builder --win nsis --prepackaged release/win-unpacked
Context: Build fails because @electron/rebuild tries to compile native modules but no C++ Build Tools are installed.
Typical causes:
npmRebuild: true(default) triggers native module rebuild- Project has native optional dependencies like
bufferutil,utf-8-validate - No Visual Studio Build Tools or C++ workload installed
Solution approach:
- If no native modules are needed: set
"npmRebuild": falsein build config - Move native modules to
optionalDependenciesso they don't block the build - If native modules ARE needed: install Visual Studio Build Tools with C++ workload
Context: The built .exe shows the default Electron atom icon instead of the app's custom icon.
Typical causes:
signAndEditExecutable: falseprevents electron-builder from editing the .exe to embed the icon- Source
icon.pngis actually a JPEG file renamed to .png (electron-builder silently fails) - Cached
.icon-icodirectory inrelease/contains stale icon data
Solution approach:
- Verify icon format:
file assets/icon.png— must say "PNG image data", NOT "JPEG image data" - If JPEG: convert to real PNG using PowerShell:
[System.Drawing.Bitmap]::new('icon.png').Save('icon_real.png', [System.Drawing.Imaging.ImageFormat]::Png) - Delete cached icon:
rm -rf release/.icon-ico - If
signAndEditExecutable: false: use rcedit to inject icon manually (see Error #6)
Context: Packaged app opens DevTools on launch — debug code left in production.
Typical causes:
mainWindow.webContents.openDevTools()guarded by wrong condition (e.g.,if (!isDev)instead ofif (isDev))- Debug code added temporarily and never removed
Solution approach:
- Search for
openDevToolsinelectron/main.ts— ensure it's only called whenisDevis true - Remove or guard all
console.logdebug statements in the main process - Add to release checklist: verify no debug code in main.ts
Context: The Electron window title shows one version but the app UI shows another.
Typical causes:
APP_VERSIONconstant inelectron/main.tsis hardcoded and not updated- Version in React components (footer, about dialog) is hardcoded separately
package.jsonversion updated but hardcoded strings weren't
Solution approach:
- Use a single source of truth: read version from
package.jsonor useapp.getVersion()in Electron - Pass version to renderer via IPC or preload script
- Search for all hardcoded version strings:
grep -r "v1\\.0\\.0" client/src/
More cases will be added as they appear in real projects.