Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"spawn npx ENOENT spawn npx ENOENT" Error in Cline VSCode MCP Server Connection

I tried to install OpenRouter MCP Server using Cline Extension in VSCode Insiders as MCP Client. I got my reference from Smithery (https://smithery.ai/server/@mcpserver/openrouterai).

This is my cline_mcp_settings.json located at "C:\Users\takan\AppData\Roaming\Code\User\globalStorage\saoudrizwan.claude-dev\settings":

{
  "mcpServers": {
    "openrouterai": {
      "command": "npx",
      "args": ["-y", "@smithery/cli@latest", "run", "@mcpserver/openrouterai"],
      "env": {
        "OPENROUTER_API_KEY": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "OPENROUTER_DEFAULT_MODEL": "google/gemini-2.0-pro-exp-02-05:free"
      }
    }
  }
}

I got "spawn npx ENOENT spawn npx ENOENT" after Cline automatically connected with the server after I saved the file.

screenshot of the Cline extension tab

like image 567
vnmw7 Avatar asked Oct 25 '25 14:10

vnmw7


2 Answers

Update your configuration file with this:

    {
  "mcpServers": {
    "openrouterai": {
      "command": "cmd",
      "args": [
        "/c",
        "npx",
        "-y",
        "@smithery/cli@latest",
        "run",
        "@mcpserver/openrouterai"
      ],
      "env": {
        "OPENROUTER_API_KEY": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "OPENROUTER_DEFAULT_MODEL": "google/gemini-2.0-pro-exp-02-05:free"
      }
    }
  }
}
like image 58
Lord Titan Avatar answered Oct 27 '25 05:10

Lord Titan


I use both of wsl2 and macos. Meanwhile, I use fnm for managing nodejs version. I met this problem on both systems. And I think I figure out the reason and solution. No matter you use cline or Cursor. Connect MCP Servers error"spawn npx enoent" means mcp client can't correctly find npx command in your system. So if you're using fnm, don't use which npx to set npx path directly. This path is temporarily created by fnm so it'll outdate when restart device. The right way is to find to your fnm directory by command which fnm. For example, mine is /Users/CHJ/.local/state/fnm_multishells/32996_1746258653075/bin/npx. Then access to /Users/CHJ/.local/share/fnm/node-version/<select a version you want to use>/installation/bin/, you should be able to see npx file. To my understanding, fnm create temporary folder based on these nodejs versions under /Users/CHJ/.local/share/fnm/. Whatever, find the npx file that is constant and permanent. Then use this path alternate the npx in every mcp setting json. For example, in wsl2 using context7 mcp server by Cursor:

{
  "mcpServers": {
    "context7": {
      "command": "wsl",
      "args": [
        "bash",
        "-c",
        "'/Users/CHJ/.local/share/fnm/node-versions/v22.15.0/installation/bin/npx -y @upstash/context7-mcp@latest'"
      ],
      "enabled": true
    }
  }
}

in macos using context7 mcp server by Cursor:

{
  "mcpServers": {
        "context7": {
            "command": "/Users/CHJ/.local/share/fnm/node-versions/v22.15.0/installation/bin/npx",
            "args": [
                "-y",
                "@upstash/context7-mcp@latest"
            ]
        }
  }
}

Hope it can help you.

like image 21
星空の物語 Avatar answered Oct 27 '25 04:10

星空の物語



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!