What Is the spawn ENOENT Error?
The spawn ENOENT error is the single most common MCP server startup failure. It means the system tried to launch a process but couldn't find the executable at the specified path. The full error typically looks like this:
Error: spawn npx ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:284:19)
at onErrorNT (node:internal/child_process:477:16)
Or in some clients you may see a more generic version:
MCP server failed to start: spawn error ENOENT
Server exited with code 1
This guide covers every known cause of this error and provides platform-specific fixes for Claude Desktop, Cursor, and VS Code.
Cause 1: npx or Node.js Not Found
The most frequent cause is that npx (or node) is not in the system PATH that your MCP client sees. GUI applications on macOS and Windows often don't inherit your shell's PATH, so even if npx works in your terminal, the client can't find it.
Fix for macOS
Use the full path to npx in your MCP configuration. Find it by running:
which npx
# Typical output: /usr/local/bin/npx or /opt/homebrew/bin/npx
Then update your claude_desktop_config.json to use the absolute path:
{
"mcpServers": {
"filesystem": {
"command": "/usr/local/bin/npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/Documents"]
}
}
}
Fix for Windows
On Windows, use npx.cmd instead of npx. Windows requires the .cmd extension for batch scripts:
{
"mcpServers": {
"filesystem": {
"command": "npx.cmd",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "C:\Users\you\Documents"]
}
}
}
If that still fails, use the full path: C:\Program Files\nodejs\npx.cmd.
Fix for Linux
Linux users using nvm or fnm should provide the full path since GUI apps won't source your .bashrc:
which npx
# Typical nvm output: /home/user/.nvm/versions/node/v20.11.0/bin/npx
Cause 2: Wrong Node.js Version
Some MCP servers require Node.js 18+ or 20+. If you have an older version, the server binary might not exist or may crash immediately, producing the ENOENT error.
node --version
# Should be v18.x or higher, ideally v20+
If you use nvm, make sure the correct version is set as default:
nvm install 20
nvm alias default 20
Cause 3: Python MCP Servers - Path Issues
Python-based MCP servers using uvx or python have the same PATH problem. The error looks like:
Error: spawn uvx ENOENT
Find the full path and use it directly:
which uvx
# Output: /home/user/.local/bin/uvx
which python3
# Output: /usr/bin/python3
Update your config accordingly:
{
"mcpServers": {
"my-python-server": {
"command": "/home/user/.local/bin/uvx",
"args": ["my-mcp-server"]
}
}
}
Cause 4: Permission Errors
On macOS and Linux, the executable might exist but lack execute permissions:
ls -la $(which npx)
# Check for 'x' in permissions: -rwxr-xr-x
# Fix permissions if needed:
chmod +x $(which npx)
On macOS, you may also need to allow the binary through Gatekeeper if it's unsigned.
Cause 5: Server Package Not Installed
If you're using npx -y and it fails, the package might not exist or the name might be misspelled. Test manually:
npx -y @modelcontextprotocol/server-filesystem --help
Common misspellings include using server-fs instead of server-filesystem. Check the filesystem server page for the correct package name.
Client-Specific Debugging
Claude Desktop
Check the Claude Desktop logs for the exact error:
- macOS:
~/Library/Logs/Claude/mcp*.log - Windows:
%APPDATA%\Claude\logs\mcp*.log
After editing claude_desktop_config.json, fully quit and relaunch Claude Desktop (not just close the window).
Cursor
In Cursor, check your .cursor/mcp.json file. Cursor uses a slightly different config format. Open the MCP panel in settings to see server status and error messages directly.
VS Code
In VS Code, open the Output panel and select the MCP extension channel. The ENOENT error with the full command will be logged there.
Step-by-Step Universal Fix
- Identify the command - Open your MCP config and note the
"command"value. - Test in terminal - Run
which <command>to verify it exists and get the full path. - Use absolute path - Replace the command name with the full path in your config.
- Check permissions - Run
ls -la <full-path>to verify execute permissions. - Restart the client - Fully quit and relaunch your MCP client.
- Check logs - If it still fails, check client-specific logs for the exact error.
Common Pitfalls
- Using
~in config paths - JSON configs don't expand~. Use the full path like/Users/yourname/.... - Forgetting
.cmdon Windows - Windows requiresnpx.cmd,node.cmd, etc. - nvm/fnm shell-only paths - Version managers only set PATH in your shell. GUI apps don't see them.
- Docker containers - If running the server in Docker, the command path is inside the container, not on the host.
- Snap-installed Node - Snap packages have restricted filesystem access that can cause ENOENT on certain paths.
If you're setting up your first MCP server, check our First MCP Server tutorial which walks through the complete setup process including avoiding this error.