---
title: "Fix spawn npx ENOENT / command not found (ENOENT)"
slug: "spawn-npx-enoent"
code: "ENOENT"
category: "Environment & Runtime"
severity: "Critical"
canonical: "https://mcp-codex.com/errors/spawn-npx-enoent"
source: "MCP Codex (https://mcp-codex.com)"
dateModified: "2026-09-28"
---

# Fix spawn npx ENOENT / command not found (ENOENT)

**Category**: Environment & Runtime | **Severity**: Critical

## 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 Remediation Commands

### MAC
```bash
# Find your exact npx binary location:
which npx
# Example output: /usr/local/bin/npx or /opt/homebrew/bin/npx
```

### WINDOWS
```bash
# Find your exact npx.cmd binary location in PowerShell:
where.exe npx.cmd
# Example output: C:\Program Files\nodejs\npx.cmd
```

### LINUX
```bash
# Find npx binary path:
which npx
# Example output: /usr/bin/npx
```

## Correct Configuration Example
```json
{
  "mcpServers": {
    "filesystem": {
      "command": "C:/Program Files/nodejs/npx.cmd",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "C:/Users/name/sandbox"]
    }
  }
}
```

## Canonical Diagnostic Link
https://mcp-codex.com/errors/spawn-npx-enoent

## Weekly Protocol & Patch Diffs
Subscribe to verified runtime fixes and schema changes: https://mcp-codex.com#newsletter
