preview_start fails with spawn npm ENOENT on Windows
Resolved 💬 3 comments Opened Feb 21, 2026 by kaiovilera Closed Feb 25, 2026
Bug Report: preview_start fails with spawn npm ENOENT on Windows
Summary
On Windows, using "runtimeExecutable": "npm" (or npx, yarn) in .claude/launch.json fails with:
spawn npm ENOENT
or
spawn EINVAL
Root Cause
On Windows, npm and npx are .cmd batch file shims, not standalone executables. Node.js's child_process.spawn() cannot resolve them without shell: true. Since the Claude Code Desktop preview tool does not expose a shell: true option, these runtimeExecutable values fail on Windows.
Steps to Reproduce
- On Windows, create a
.claude/launch.jsonwith: - ```json
- {
- "preview": {
- "runtimeExecutable": "npm",
- "args": ["run", "dev"],
- "cwd": "${workspaceFolder}"
- }
- }
- ```
- 2. Run
preview_startfrom Claude Code Desktop. - 3. Observe
spawn npm ENOENTerror.
Same issue occurs with "runtimeExecutable": "npx", "npm.cmd", etc.
Expected Behavior
Either:
npm/npxshould work asruntimeExecutableon Windows (via internalshell: true), OR- - The documentation should note that Windows requires using
nodedirectly asruntimeExecutable
Workaround
Use node directly as the runtimeExecutable and point to the JS entry file:
{
"preview": {
"runtimeExecutable": "node",
"args": ["node_modules/vite/bin/vite.js"],
"cwd": "${workspaceFolder}"
}
}
This works on Windows but diverges from the documented examples.
Environment
- OS: Windows
- - Issue:
child_process.spawn()cannot execute.cmdshims withoutshell: true
References
- Official docs show
"runtimeExecutable": "npm"which works on macOS/Linux but not Windows - - Node.js docs: https://nodejs.org/api/child_process.html#child_processspawncommand-args-options
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗