Fix better-sqlite3 installation on Windows

This commit is contained in:
larssand
2026-08-24 15:48:34 +02:00
parent de7b4adfe0
commit 79a8cb24b8
4 changed files with 442 additions and 27 deletions

View File

@@ -49,21 +49,25 @@ Start-Process powershell -Verb RunAs -ArgumentList '-ExecutionPolicy Bypass -Fil
Install Node.js 22 or 24 LTS, then run in the repository root:
```powershell
npm ci
npm run verify
npm start
npm.cmd ci
npm.cmd run verify
npm.cmd start
```
`npm ci` installs exactly the dependency versions in `package-lock.json`. The install fails early with an actionable message if Node.js is unsupported. The post-install verification also fails if the native SQLite module cannot run.
The project intentionally uses `better-sqlite3` v12.11.x. That release provides a working prebuilt Windows binary for the supported Node.js versions. The package is explicitly listed in `allowScripts` so npm 12 may run its binary installer; do not use `npm ci --ignore-scripts`.
Use `npm.cmd` from PowerShell when local execution policy blocks `npm.ps1`. The plain `npm` command works normally from Command Prompt (`cmd.exe`).
## Runtime commands
```powershell
npm start
npm run status
npm restart
npm stop
npm run start:fg
npm.cmd start
npm.cmd run status
npm.cmd restart
npm.cmd stop
npm.cmd run start:fg
```
- `npm start` starts `server.js` in the background.
@@ -150,8 +154,8 @@ Do not expose the full admin UI directly to the internet. Publish only `/public-
4. Reopen PowerShell and run:
```powershell
npm ci
npm run verify
npm.cmd ci
npm.cmd run verify
```
## Update an existing installation
@@ -159,11 +163,11 @@ npm run verify
Stop the service, update the files, reinstall locked dependencies, verify, and restart:
```powershell
npm stop
npm.cmd stop
git pull
npm ci
npm run verify
npm start
npm.cmd ci
npm.cmd run verify
npm.cmd start
```
Keep `data\` when updating. It contains the SQLite database, saved state, PID file, and local AMMC configuration.