Windows repair note

Fix: better-sqlite3 in Electron on Windows

better-sqlite3 is a native module. In an Electron app, the binary has to match the runtime that loads it, not just the Node version visible in PowerShell. Check package state, ABI clues, and the rebuild path before reinstalling everything.

Cannot find module 'better-sqlite3' / NODE_MODULE_VERSION / No native build was found
1

Confirm the project and versions

Run these from the Electron project root. If package.json is missing, fix the folder first.

Get-Location
Test-Path .\package.json
npm ls better-sqlite3
npm ls electron
node -v
npm -v
2

Check whether the native binary exists

If there is no .node binary, the install or rebuild did not produce the native module. If it exists but Electron rejects it, suspect ABI mismatch.

Test-Path .\node_modules\better-sqlite3
Get-ChildItem .\node_modules\better-sqlite3 -Recurse -Filter "*.node" | Select-Object -First 10 FullName
3

Try a focused rebuild

Start with the package itself. If the project already has an Electron rebuild script, use that project script next.

npm rebuild better-sqlite3
npm run dev
4

Use Electron rebuild only when the project expects it

For Electron loaders, a Node-only rebuild may not be enough. Use the project's existing electron-rebuild or @electron/rebuild path when present.

npm run
# If the project uses electron-rebuild:
npx electron-rebuild -f -w better-sqlite3
npm run dev
5

Check Build Tools only if rebuild compiles

Visual Studio Build Tools matter when logs mention node-gyp, MSBuild, cl.exe, VCBuild, Windows SDK, or missing prebuilds.

npm config get msvs_version
& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -property installationPath

When to use the paid kit

If the quick checks do not get the app running, the full WiaiKit recovery kit gives the ordered Windows path for npm, Electron, native modules, Visual Studio Build Tools, and Push-to-Talk setup.

better-sqlite3Electron native modulesNODE_MODULE_VERSIONnode-gypVisual Studio Build Tools

Get the recovery kit for 13 USD

Independent practical material. Not an official OpenAI, Codex, Electron, Node.js, or OpenWhispr product.