fix(ci): stop source-building better-sqlite3 in the desktop build - #675
Merged
Conversation
The Windows desktop leg has failed on every release since v0.64.0 (2026-08-11), so no `.exe` installer has shipped since v0.63.0. macOS, Linux, the release job and the image publish were all unaffected, which is why this stayed quiet: only the Windows matrix entry went red. Root cause: `better-sqlite3` was bumped 12 -> 13 in a42b1d5 (#615). v13 is N-API and ships prebuilt binaries for all platforms inside its own tarball, so it declares `gypfile: false` to tell npm not to build it. npm ignores that field and synthesises `install: node-gyp rebuild` anyway, purely because a `binding.gyp` is present in the package. macOS/Linux just waste time on the pointless compile; windows-latest has no Visual Studio node-gyp can find, so `npm ci` dies outright: gyp ERR! find VS could not find a version of Visual Studio 2017 or newer The same defect was already diagnosed and fixed for the container build in #615 — the root Dockerfile carries `npm ci --ignore-scripts` plus an explicit `npm rebuild argon2 esbuild`. The desktop workflow was simply missed. Apply the identical treatment here. Also drop the now-doubly-dead `GYP_MSVS_VERSION: '2022'` job env. It never had any effect (node-gyp reads `npm_config_msvs_version`, and the failing run logs "msvs_version not set from command line or npm config"), and its value is wrong regardless: the runner image now ships Visual Studio 18, which node-gyp 11.5.0 rejects as `unknown version "undefined"`. And replace the "Provision better-sqlite3 for Electron" step with the verification it already carried. That step could only ever fail or no-op: upstream publishes no GitHub release assets for v13, so `prebuild-install` always missed and fell through to a source rebuild — and even when that rebuild succeeded, its artefact was never loaded, because v13's loader in `lib/binding.js` resolves `prebuilds/` FIRST and only falls back to `build/Release/`. The Electron ABI check is kept as the real gate. Verified locally: `npm ci --ignore-scripts` on better-sqlite3 13.0.3 produces no `build/` directory, runs no node-gyp, and the module loads and executes SQL from the bundled prebuild.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Windows leg of
desktop-appshas failed on every release since v0.64.0 (2026-08-11). No.exeinstaller has shipped since v0.63.0.This stayed quiet because nothing else broke: the
releasejob,publish-images, and the macOS/Linux installers are all green. Only thewindows-latestmatrix entry goes red — which is enough to paint everyauto-releaserun as failed.Confirmed across the last 10 failing runs: identical job, identical step.
.exeRoot cause
better-sqlite3was bumped 12 → 13 in a42b1d5 (#615), merged 2026-08-11 06:20 UTC. The first redauto-releaseran 07:49 UTC the same day.v13 is N-API and ships prebuilt binaries for every platform inside its own tarball — including
prebuilds/win32-x64.node. That is why it declaresgypfile: false: "do not build me". npm ignores that field and synthesisesinstall: node-gyp rebuildregardless, purely because abinding.gypis present in the package.macOS and Linux merely waste time on that pointless compile.
windows-latesthas no Visual Studio node-gyp can locate, sonpm cifails outright.This exact defect was already diagnosed and fixed for the container build in #615 — the root
Dockerfilecarriesnpm ci --ignore-scriptsplus an explicitnpm rebuild argon2 esbuild, with a comment spelling out the same reasoning. The desktop workflow was simply missed. This PR applies the identical, already-proven treatment.Changes
npm ci --ignore-scripts --no-audit --no-fund+npm rebuild argon2 esbuildin Build middleware kernel, mirroring the Dockerfile.argon2andesbuildare the only middleware packages with a real install script (fseventsis macOS-only and optional).Drop
GYP_MSVS_VERSION: '2022'— dead twice over. It never had any effect (node-gyp readsnpm_config_msvs_version; the failing run logs "msvs_version not set from command line or npm config"), and the value is wrong anyway: the runner image now ships Visual Studio 18, which node-gyp 11.5.0 rejects asunknown version "undefined". Worth stressing: "just install MSVC" would not have been a reliable fix.Replace Provision better-sqlite3 for Electron with the verification it already contained. That step could only fail or no-op:
prebuild-install -r electronalways missed and fell through to a source rebuild — which needs the very toolchain Windows lacks;lib/binding.js) resolvesprebuilds/first and only falls back tobuild/Release/.So today's macOS/Linux builds already run on the bundled prebuild, not on the electron-rebuild output. Removing the rebuild changes nothing observable there.
Verification
Reproduced and verified locally against
better-sqlite3@13.0.3:npm ci(andnpm install) runnode-gyp rebuilddespitegypfile: falsebeing present in both the registry manifest and the tarball's ownpackage.json. (Note: the Dockerfile comment claimsnpm installhonours the field — measured on npm 11.16.0, both ignore it. Not corrected here to keep this diff scoped.)win32-x64.nodeincluded.npm ci --ignore-scriptsproduces nobuild/directory, invokes no node-gyp, and the module loads and executes SQL from the bundled prebuild.The Electron ABI check is deliberately kept as the real gate: if the N-API/ABI-stability assumption is ever wrong, the build fails there rather than crashing the kernel at boot in the shipped app.
Merge check: the first
auto-releaserun after merge should attach a Windows.exeagain. Worth watching, since the Windows leg has not progressed past step 1 in two days —web-uianddesktopcarry nobetter-sqlite3and no node-gyp packages, so they are expected to pass, but that is an expectation this PR cannot prove on its own.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.