Skip to content

Feat: upgrade electron to version 25 and enforce source compilation for native modules#331

Open
egalvis27 wants to merge 3 commits intofeat/go-fuse-daemonfrom
feat/upgrade-electron-to-25
Open

Feat: upgrade electron to version 25 and enforce source compilation for native modules#331
egalvis27 wants to merge 3 commits intofeat/go-fuse-daemonfrom
feat/upgrade-electron-to-25

Conversation

@egalvis27
Copy link
Copy Markdown

What is Changed / Added

Problem

The app was crashing with a segmentation fault immediately after loading the SQLite database. GDB traced the crash to Statement::JS_new() inside better-sqlite3.node.

Root cause: Electron 23 and 25 both assign module ABI 116, so version checks pass — but they ship different V8 versions:

Electron V8 version Node (internal)
23 10.2 18.12.2
24 11.0 18.17.x
25 11.4 18.15.0

The official better-sqlite3 prebuilt for electron-v116 was compiled against Electron 24 (V8 11.0). Running it under Electron 25 (V8 11.4) causes an internal V8 layout mismatch that segfaults in Statement::JS_new().

A secondary motivation for the upgrade: fs.statfs (used by NodeTemporalFileRepository) was added in Node 18.15.0. Electron 23 bundles Node 18.12.2, which does not have it — causing a TypeError: fs.statfs is not a function crash in production.

Changes

package.json

  • Bumped electron from ^23.3.13^25.0.0 (resolves to 25.9.8), which bundles Node 18.15.0 and V8 11.4.

beforeBuild.js

  • Set npm_config_build_from_source = 'true' before calling electron-rebuild, which forces prebuild-install to skip the prebuilt download and fall back to node-gyp rebuild using the correct Electron headers from https://electronjs.org/headers.
  • Added force: true to the electron-rebuild call to bypass the .forge-meta cache, ensuring the binary is always recompiled for the active Electron version.

Verification

  • better-sqlite3 compiled and tested against Electron 25 V8 11.4 — no crash.
  • All 1365 tests pass (1130 main + 235 renderer).
  • Packaged .deb contains the source-compiled better_sqlite3.node (confirmed by Build ID change).

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 7, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant