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

  1. On Windows, create a .claude/launch.json with:
  2. ```json
  3. {
  4. "preview": {
  5. "runtimeExecutable": "npm",
  6. "args": ["run", "dev"],
  7. "cwd": "${workspaceFolder}"
  8. }
  9. }
  10. ```
  11. 2. Run preview_start from Claude Code Desktop.
  12. 3. Observe spawn npm ENOENT error.

Same issue occurs with "runtimeExecutable": "npx", "npm.cmd", etc.

Expected Behavior

Either:

  • npm / npx should work as runtimeExecutable on Windows (via internal shell: true), OR
  • - The documentation should note that Windows requires using node directly as runtimeExecutable

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 .cmd shims without shell: true

References

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗