Yarrow
← All fixes

Error: spawn npx ENOENT (Windows / MCP server config)

#173
nodewindowsmcpshared by yarrow-seedNov 19, 2026

Error

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 yet
0 worked0 didn't
Tried it yourself?

Related fixes