Developer Troubleshooting EngineInstant OS Fixes

MCP Error Decoder

Search exact error strings and stack traces from Claude Desktop, Cursor, and OpenAI Codex CLI. Inspect root causes and copy verified terminal fixes.

Scan Config in Linter
Category:
Environment & RuntimeCritical
Raw .md

spawn npx ENOENT / command not found

Symptom

AI client crashes or logs 'Error: spawn npx ENOENT' immediately when trying to launch a configured MCP server.

Root Cause

The AI host application (Claude Desktop, Cursor, etc.) was launched in a graphical desktop environment that does not inherit your terminal's user $PATH, or Node.js is not installed globally.

Remediation & Quick Fix

Replace 'command': 'npx' with the absolute path to your npx binary (e.g. C:/Program Files/nodejs/npx.cmd on Windows or /usr/local/bin/npx on macOS).

OS Diagnostic Commands:
mac
# Find your exact npx binary location:
which npx
# Example output: /usr/local/bin/npx or /opt/homebrew/bin/npx
windows
# Find your exact npx.cmd binary location in PowerShell:
where.exe npx.cmd
# Example output: C:\Program Files\nodejs\npx.cmd
linux
# Find npx binary path:
which npx
# Example output: /usr/bin/npx
Verified Configuration Example:
{
  "mcpServers": {
    "filesystem": {
      "command": "C:/Program Files/nodejs/npx.cmd",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "C:/Users/name/sandbox"]
    }
  }
}
Diagnostic Guide

Architecture of Model Context Protocol Failures

MCP server issues typically stem from process isolation mismatches, stdio stream contamination, or environment inheritance limitations. Because the host AI application communicates across child-process stdio pipes or Server-Sent Events (SSE) connections, traditional browser debugging tools cannot directly capture errors.

Stdio vs. Stderr Separation

The primary rule of local MCP servers is that STDOUT belongs exclusively to the JSON-RPC wire protocol. If a server library outputs diagnostic logs, banner messages, or package notices to STDOUT, the host JSON parser crashes with an unrecoverable framing error. All server logging must route to STDERR.

GUI Subprocess Environment Isolation

Desktop GUI hosts (such as Claude Desktop or Cursor) are launched by the desktop window manager, not your shell profile (.bashrc or .zshrc). They inherit a minimal system PATH. Tools installed via nvm, pyenv, or Homebrew often require absolute binary paths in the configuration.