error hub
spawn npx ENOENT
Public KFA evidence for desktop and agent clients that cannot locate npx while spawning an MCP server.
Common Problems
- MCP stdio servers on Windows fail with 'spawn npx ENOENT' (or 'spawn EINVAL' for .cmd) — Node can't spawn npx.cmd without a shell; wrap with cmd /c
Cause: on Windows, `npx` is `npx.cmd`, a batch shim, not a native executable. Node's `child_process.spawn("npx", ...)` looks for a file named exactly `npx` on PATH — it only resolves `.cmd`/`.bat` via PATHEXT when `shell: true` (or `shell: 'cmd.exe'`) is set, or when given the explicit `.cmd` filename — so it finds not
- How should an MCP stdio client diagnose spawn npx ENOENT?
## Question How should an MCP stdio client diagnose spawn npx ENOENT? ## Why this matters Recurring public developer task for MCP. ## Environment / product MCP ## What needs to be determined Current researched guidance, applicability, limitations, and primary sources for this question. Researched guidance is proposed,
- MCP TypeScript client custom env removes PATH and causes spawn npx ENOENT
## Problem - MCP TypeScript client custom env removes PATH and causes spawn npx ENOENT ## Observed symptom - The stdio connection works without env overrides and fails with spawn npx ENOENT when a custom env is supplied. - Observed in 1 reviewed public artifact; this is not a claim that only that many reports exist. ##
- spawn npx ENOENT in a desktop MCP client while the terminal works
## Problem - spawn npx ENOENT in a desktop MCP client while the terminal works ## Observed symptom - A desktop editor/client reports spawn npx ENOENT, but npx resolves in an interactive terminal. - Observed in 3 reviewed public artifacts; this is not a claim that only that many reports exist. ## Exact error or signatur
- Claude Desktop cannot resolve npx installed through a shell version manager
## Problem - Claude Desktop cannot resolve npx installed through a shell version manager ## Observed symptom - npx works in fish/zsh, but Claude Desktop reports spawn npx ENOENT for npm MCP servers. - Observed in 2 reviewed public artifacts; this is not a claim that only that many reports exist. ## Exact error or signa
- Bare npx command fails to launch MCP servers on Windows
## Problem - Bare npx command fails to launch MCP servers on Windows ## Observed symptom - A Windows MCP host reports spawn npx ENOENT or EINVAL while a shell or explicit Node executable can start the server. - Observed in 4 reviewed public artifacts; this is not a claim that only that many reports exist. ## Exact erro
Solutions with evidence
- Researched guidance: How should an MCP stdio client diagnose spawn npx ENOENT?
## Summary Treat MCP stdio `spawn npx ENOENT` as an ambiguous process-creation failure: the configured `npx` may be unresolvable in the launching process environment, or the requested working directory may be absent. Diagnose both in the same sanitized runtime context before changing the MCP command. ## Candidate actio
- On Windows, launch npx-based MCP servers via cmd /c (or an absolute npx.cmd / node.exe path)
spawn npx ENOENT is Windows failing to run the npx.cmd shim without a shell. Wrap the command in cmd /c (or use absolute paths).