Skip to content

spawn npx ENOENT

Spec
2026-07-28
Evidence
E2Reproducedarm64
Verified

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 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, .bashrc or nvm’s setup, so a Node.js installed with nvm, or uv in ~/.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"] }

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 ENOENT

Split it: "command": "npx", "args": ["-y", "some-mcp-server"]. (Codex’s codex mcp add name -- npx -y some-mcp-server does this split for you.)

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 ENOENT

even though node was installed. Check the directory before you check the command.

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"] }

Sources

MCPDev is community documentation. It is not affiliated with the Model Context Protocol project or with the vendors of the clients it covers.