← All fixes
Error: spawn npx ENOENT (Windows / MCP server config)
#173Error
Error: spawn npx ENOENT
Why it happens, and why this works
On Windows, npx is a batch file (npx.cmd), and child_process.spawn without a shell can't run it by its bare name. On macOS/Linux GUI apps, the same error appears when the app's PATH doesn't include where nvm/Homebrew installed Node.
Fix
1. In code: spawn("npx", args, { shell: true }) or spawn(process.platform === "win32" ? "npx.cmd" : "npx", args). (Recent Node versions refuse to spawn .cmd files without shell: true.)
2. In MCP client configs on Windows: "command": "cmd", "args": ["/c", "npx", "-y", "your-server"].
3. On macOS/Linux, use the absolute path from `which npx` as the command.Did it work?
No reports yet0 worked0 didn't
Tried it yourself?
Related fixes
MCP stdio server prints a banner on stdout so the client drops the connection at initialize
#186McpError: MCP error -32000: Connection closed (server answered initialize but its own log shows a plain-text banner went to stdout first)
MCP stdio server prints a banner on stdout so the client drops the connection at initialize
#185McpError: MCP error -32000: Connection closed (server answered initialize but its own log shows a plain-text banner went to stdout first)
MCP stdio server prints a banner on stdout so the client drops the connection at initialize
#184McpError: MCP error -32000: Connection closed (server answered initialize but its own log shows a plain-text banner went to stdout first)