spawn npx ENOENT
- Spec
2026-07-28- Evidence
- E2Reproducedarm64
- Verified
What it means
Section titled “What it means”ENOENT means “no such file or directory”. The client tried to start the program named in command and the operating system could not find it, so no server process ever ran. We got these messages:
| Client | Message |
|---|---|
| TypeScript SDK v1 and v2 clients | spawn no-such-command-xyz ENOENT |
Claude Code 2.1.312 (claude mcp list) |
Issue: ENOENT: Executable not found in $PATH: "no-such-command-xyz" |
| Codex CLI 0.164.0 (startup warnings, F2) | MCP client for `ghost` failed to start: MCP startup failed: No such file or directory (os error 2) |
The word after spawn is the exact command the client tried to run. Read it carefully: it usually tells you which cause below applies.
The command is not on the client’s PATH
Section titled “The command is not on the client’s PATH”The most common case. npx, uvx, uv, node or python work in your terminal, but the client was not started from that terminal:
- Desktop apps on macOS and Linux do not read
.zshrc,.bashrcor nvm’s setup, so a Node.js installed with nvm, oruvin~/.local/bin, is invisible to them. - After installing a tool, a client that was already running still has the old PATH. Restart it.
Fix: put the full path in command. Find it in a terminal with which npx (macOS, Linux) or where npx (Windows).
{ "command": "/Users/me/.nvm/versions/node/v24.21.0/bin/npx", "args": ["-y", "some-mcp-server"] }The whole command line is in command
Section titled “The whole command line is in command”command is the program only. Arguments go in args. With "command": "npx -y some-mcp-server", the client looks for a program literally named npx -y some-mcp-server:
spawn npx -y some-mcp-server ENOENTSplit it: "command": "npx", "args": ["-y", "some-mcp-server"]. (Codex’s codex mcp add name -- npx -y some-mcp-server does this split for you.)
The working directory does not exist
Section titled “The working directory does not exist”If the client supports a working directory option (cwd) and it points to a folder that does not exist, Node.js reports it as the command being missing. With cwd: '/nonexistent-dir' the TypeScript client said:
spawn node ENOENTeven though node was installed. Check the directory before you check the command.
Windows: npx and uvx are not executables
Section titled “Windows: npx and uvx are not executables”On Windows, npx is a batch script (npx.cmd). The Node.js documentation says .bat and .cmd files “are not executable on their own without a terminal” and are started by spawning cmd.exe with the file as an argument. Clients that start servers without a shell then fail with spawn npx ENOENT. The usual fix:
{ "command": "cmd", "args": ["/c", "npx", "-y", "some-mcp-server"] }Related
Section titled “Related”- MCP error -32000: Connection closed: the program started but then exited.
- stdio troubleshooting checklist
Sources
MCPDev is community documentation. It is not affiliated with the Model Context Protocol project or with the vendors of the clients it covers.