Skip to content
Strata v1.2.6

2026-05-15: Fix backend crash on desktop launch — npx in stripped PATH

After v1.2.5 fixed lib.rs, the desktop app passed the Prisma migration step but the backend failed to become healthy:

Backend health check 1/30 …
Backend did not become healthy after 30 attempts
Some services failed to start

Root cause: backend/src/main.ts also calls execSync('npx prisma migrate deploy') inside NestJS bootstrap. When Tauri spawns the backend with macOS stripped PATH (/usr/bin:/bin:/usr/sbin:/sbin), npx is not found → backend crashes immediately → health checks all fail.

There were two separate places calling npx prisma:

  1. src-tauri/src/lib.rs — fixed in v1.2.5
  2. backend/src/main.ts — fixed in this release

Replace execSync('npx prisma migrate deploy') with:

const prismaJs = path.join(__dirname, '..', 'node_modules', 'prisma', 'build', 'index.js');
execFileSync(process.execPath, [prismaJs, 'migrate', 'deploy'], {
stdio: 'inherit',
env: { ...process.env },
});
  • process.execPath = absolute path to the running node binary (set by Tauri’s find_node() call) — works without PATH
  • prismaJs = local prisma binary from backend/node_modules/ — works without PATH
  • Also works in Docker and npm run start:dev modes (same node binary, same local prisma)
#ConventionCheck
1DocsThis plan + execution summary
2Test gatesBackend unit + build + tauri:install launch
3Self-review
4Endpoint coverageN/A
5Bug-to-Testtauri:install + double-click verify
6Seed isolationN/A
7Transaction invariantsN/A
8Plan history✅ this file
9Infra test gatenpm run tauri:install + launch verify
10Env compatN/A
11Do-no-harmDocker/dev mode migration still works
12Execution summaryAppend after done
13Doc grepN/A
14Semver releasev1.2.6 patch

Commit: 52a118f

  • backend/src/main.ts — replaced execSync('npx prisma migrate deploy') with execFileSync(process.execPath, [prismaJs, 'migrate', 'deploy']) using local node_modules/prisma/build/index.js

None.

GateResult
Backend build (nest build)✅ success
Backend unit (npm test)✅ 319 tests passed
npm run tauri:install✅ built and installed
Double-click launch✅ backend healthy on port 3456, dashboard loads
Backend e2e⏭ not affected
Frontend unit / e2e⏭ not affected
  • backend/dist/ is gitignored — tauri-build.sh rebuilds it from source during npm run tauri:install. The fix only needs to be in src/main.ts.
  • process.execPath in the child NestJS process equals the node binary that Tauri used to spawn it (find_node() result), so the pattern is self-consistent.
  • __dirname in compiled CJS dist/main.js = backend/dist/, so path.join(__dirname, '..', 'node_modules', ...) = backend/node_modules/prisma/build/index.js