pnpm dev fails on Windows with spawn EINVAL
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- javascript, nodejs
Research direction
Start in scripts/dev.mjs, focusing on run() and the platform-specific pnpm command resolution. Reproduce with pnpm dev on Windows, then verify that only batch-file commands use shell handling while docker and POSIX execution retain their current behavior. Done means the development stack starts and the friendly startup error handling remains usable.
Written by the indexing model from the issue text.
Description
Summary
pnpm dev cannot start the stack on Windows. It fails immediately with Error: spawn EINVAL before Postgres, the API, the gateway or the web app come up.
Environment
- Windows 10 (10.0.26200), PowerShell
- Node v22.23.2
- pnpm 11.20.0
facilityatae68401
Reproduction
pnpm dev
Actual
Error: spawn EINVAL
at ChildProcess.spawn (node:internal/child_process:420:11)
at spawn (node:child_process:787:9)
errno: -4071,
code: 'EINVAL',
syscall: 'spawn'
Expected
The development stack starts, as it does on macOS and Linux.
Root cause
scripts/dev.mjs resolves the package manager to a batch file on Windows:
const pnpm = process.platform === "win32" ? "pnpm.cmd" : "pnpm";
but run() spawns it without a shell:
const child = spawn(command, args, { cwd, env: environment, stdio: "inherit" });
Since Node 18.20 / 20.12 (the fix for CVE-2024-27980), child_process.spawn refuses to launch a .cmd or .bat file unless shell is set, and raises EINVAL.
Every pnpm invocation in the script is affected: pnpm install, the shared-package build, @facility/db migrate, @facility/db seed, and pnpm run dev:services. The first one aborts the run.
A secondary effect: spawn throws synchronously here, so the child.once("error", ...) handler in run() never runs and the friendly Could not start <label> hint is replaced by a raw stack trace, which makes the failure harder to diagnose than it needs to be.
Minimal confirmation on the same machine:
pnpm.cmd no-shell (current) : SYNC THROW code=EINVAL
pnpm.cmd shell:true : exited code=0
docker no-shell : exited code=0
docker is unaffected because it is a real executable, so the fix should be narrow rather than applying a shell to every spawn.
Suggested fix
Set shell only for .cmd and .bat commands on win32, leaving real executables and POSIX platforms with their current argument handling.
Happy to open a PR for this.
- Dominant language
- TypeScript
- Stars
- 71
- Forks
- 64
- Avg merge
- 15h 38m
- Merged PRs (30d)
- 66
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from theam/facility
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Similar issues
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
vercel/react-tweet#225 ·