Skip to content

fix: resolve native .exe target in Claude Code npm shim on Windows - #25

Open
tjoker911 wants to merge 1 commit into
MeisnerDan:mainfrom
tjoker911:fix/windows-cmd-shim-exe-resolution
Open

fix: resolve native .exe target in Claude Code npm shim on Windows#25
tjoker911 wants to merge 1 commit into
MeisnerDan:mainfrom
tjoker911:fix/windows-cmd-shim-exe-resolution

Conversation

@tjoker911

Copy link
Copy Markdown

Summary

  • Newer @anthropic-ai/claude-code npm installs ship a bundled native claude.exe binary instead of a cli.js entry point.
  • The daemon's .cmd shim resolver (scripts/daemon/runner.ts) only matched .js targets, so on affected installs it fell through and tried to spawn the .cmd shim directly.
  • child_process.spawn() on Windows rejects spawning .cmd files directly with shell: false, throwing spawn EINVAL. Every task launch (Launch button, daemon, continuous missions) failed immediately with this error.
  • Fixed the resolver to detect and resolve .exe targets from the shim as well, spawning the native binary directly instead of routing through node.exe.

Test plan

  • pnpm tsc --noEmit passes
  • pnpm test — all 193 tests pass
  • Reproduced the original EINVAL failure on Windows with a current global npm install of Claude Code (shim pointing at bin/claude.exe)
  • Confirmed the fix resolves and spawns the native .exe correctly, verified via a real task run through /api/tasks/[id]/run

🤖 Generated with Claude Code

Newer @anthropic-ai/claude-code npm installs ship a bundled claude.exe
instead of a cli.js entry point, but the daemon's .cmd shim resolver
only matched .js targets. It fell through to spawning the .cmd shim
directly, which Windows rejects with EINVAL. Now resolves .exe targets
and spawns them directly instead of routing through node.exe.

Also commit pnpm's approved-builds config so future installs don't
need to re-approve esbuild/sharp/unrs-resolver postinstall scripts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant