Skip to content

scripts/dev-desktop.mjs fails on Windows: spawnSync npm ENOENT #30

Description

@freetag369

Environment

  • Windows 11 (10.0.26200)
  • Node v22.23.1, npm 10.9.8
  • repo @ 872f363

Symptom

node scripts/dev-desktop.mjs (the one-command dev flow) dies immediately on the first step:

Error: spawnSync npm ENOENT

Cause

The script makes a few POSIX assumptions:

  1. execFileSync("npm", ...) (scripts/dev-desktop.mjs lines 82 and 97) — on Windows npm is npm.cmd, and .cmd files cannot be spawned without shell: true (or resolving the full npm.cmd path explicitly).
  2. run() spawns node_modules/.bin/<tool> directly (line 28) — on Windows those are .cmd shims too, so vite and electron-forge hit the same ENOENT even once (1) is fixed.
  3. Teardown signals the process group with process.kill(-child.pid, "SIGTERM") under detached: true (lines 28 and 44) — negative-PID process-group signalling does not exist on Windows; tearing down the tree there needs something like taskkill /pid <pid> /T.
  4. Minor but related: the apps/cli build script ends with chmod +x dist/index.js, which fails on Windows (after esbuild has already produced the bundle, so the output itself is fine).

Workaround

Start the pieces manually, which works fine:

  1. npm run build --workspace=@diffusionstudio/cli
  2. run Vite in apps/web
  3. electron-forge start in apps/desktop

With the CLI handshake fix for Windows named pipes (submitted separately as a PR), the full dapi mount → capture → render flow then works on Windows.

Happy to follow up with a PR making dev-desktop.mjs Windows-aware if you'd take one — it's a slightly bigger change than the handshake fix, so I've kept it as a report for now.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions