Fix "spawn npx ENOENT" in MCP Server Setup
Last updated March 2026 · 5 min read
Error: spawn npx ENOENT
This error means the MCP client cannot find the npx command. It is the single most common MCP setup error, affecting 30+ GitHub repos across Claude Desktop, Cursor, VS Code, and Windsurf.
Why This Happens
MCP clients launch your server as a subprocess. When the config says "command": "npx", the client calls the operating system to find and run npx. The error means the OS could not find it. Three common causes:
- Windows:
npxis a.cmdscript, not a binary executable. Some MCP clients cannot run.cmdfiles directly. - nvm / mise / Homebrew: Node.js installed via a version manager is not in the system PATH that GUI applications inherit. Your terminal finds
npx, but Claude Desktop does not. - Node.js not installed:
npxcomes with Node.js. If Node is not installed,npxdoes not exist.
Fix 1: Windows — Use cmd /c Wrapper
On Windows, wrap the command with cmd /c:
{
"mcpServers": {
"my-server": {
"command": "cmd",
"args": ["/c", "npx", "-y", "@modelcontextprotocol/server-filesystem", "C:\Users\you\docs"]
}
}
} This tells Windows to run npx through the command processor, which knows how to handle .cmd scripts.
Fix 2: Use Absolute Path to npx
Find the full path to npx and use it directly:
# macOS / Linux
which npx
# Example output: /usr/local/bin/npx
# Windows
where npx
# Example output: C:\Program Files\nodejs\npx.cmd Then use the absolute path in your config:
{
"mcpServers": {
"my-server": {
"command": "/usr/local/bin/npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"]
}
}
} Fix 3: nvm Users — Set the Correct Path
If you use nvm, the path to npx changes per Node version. Find it:
# macOS/Linux with nvm
nvm which current
# Example: /Users/you/.nvm/versions/node/v20.11.0/bin/node
# The npx path is in the same directory:
# /Users/you/.nvm/versions/node/v20.11.0/bin/npx Use this full path in your MCP config. Note: if you switch Node versions with nvm use, you need to update the path.
For nvm-windows, the path is typically C:\Users\you\AppData\Roaming\nvm\v20.11.0\npx.cmd — and you still need the cmd /c wrapper.
Fix 4: Use uvx Instead of npx (Python MCP Servers)
For Python-based MCP servers, use uvx instead of npx:
{
"mcpServers": {
"my-python-server": {
"command": "uvx",
"args": ["my-mcp-server"]
}
}
} uvx (from the uv package manager) does not have the .cmd issue on Windows.
Quick Diagnostic
Use our MCP Config Debugger — paste your config and it will automatically detect this error and suggest the fix for your OS.
Still Not Working?
- Make sure
-yis the first argument afternpx(skips the interactive confirmation prompt) - Restart your MCP client after editing the config file
- On Windows, check if your config is at the correct path — see our Config Debugger for MSIX path issues
- Check the MCP client logs for more details (Claude Desktop:
~/Library/Logs/Claude/mcp*.logon macOS)