You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using NVM (Node Version Manager), the standard installation and usage instructions for MCP servers don't work. The app tries to use an incorrect Node and fails.
Workaround
Avoid npx, install packages globally.
Use absolute paths to both the Node executable and server script.
Reacted by Leonardo Borges Avelino, Aravind Balla, shaun smith, Phil, 郑国庆, Daniel Tedesco, Shun Sakai, Louis-Philippe Préfontaine-Dastous, So Onishi, Jan Z and 137 more
Reacted by Stephen Blum, Adit Shah, Maksim Kiselev and Maanaesh Swamy
Reacted by gitgirees, keniwata, Valery Litvin, Abdullah AlJemaz, GARCHENG, Marc Vergara Ferrer, yugo969, Alex058558, Greg Talarico, Mateus Henrique Calza and 12 more
Reacted by Mathias Prost, Stephen Blum, Adit Shah and Maanaesh Swamy
Reacted by ᒍ ᗩ ᑕ K , Thomas Wood, Stephen Blum, Maanaesh Swamy and Zakaria Tozy
The challenge with NVM is that it seems to mostly work by installing a very complicated shell function into your shell profile. It'd be great if we could figure out your preferred Node version via NVM, but I haven't found a good way to do that—open to ideas!
Reacted by Rajasegar Chandran, zaphodtx, Lucas, Jeff Boothe, David Lemayian, jianmuX, Damien Garaud, Cole Murray and Trang Le
suggestion: the same way that there is the mcpServers field, can there also be an eg mcpShell field? Or maybe a shell or source key per individual server, eg "shell": "source /Users/user/mcp.sh" ? Might introduce 'too much' flexibility but it could make mcp more usable/transparent to tinker with.
I was struggling to get MCP working yesterday, the error messages in the logs were unhelpful, and the most confusing of all is that it just started working today. This might not be the repo for this request, but it would be really useful if it was explicily documented which shell Claude Desktop is using to start the MCP services.
To your question @jspahrsummers, wouldn't nvm alias default work?
Unfortunately no, the environment for GUI apps is completely different from what you see on the command line.
Ah right, I had a look and to answer my own question, assuming that Claude Desktop's Electron implementation uses the MCP TS SDK, it's node:child_process spawn with shell: false.
In the meantime, I have migrated from NVM to mise, and now, if I start the Claude app from my shell (open -a Claude), it can correctly use node and npm (it didn’t work with NVM). That might be a workaround for some people with the same problem.
PS Apple seems to have removed an option to set up the environment for the GUI apps through the launch agents. But I'm not sure. I didn’t dive too deep into it.
Reacted by Mike Earley, Jonathan Strange, rube-de, Justin Dehorty, Mike Nitchie, Tyler Russell, Steven Wu, Jonathan Rico and Ayyaz Zafar
Potentially easier workaround that I don't think has been mentioned yet--place a script somewhere like /usr/local/bin/npx-for-claude:
#!/bin/zsh
source ~/.zshrc
exec npx "$@"
Then chmod +x /usr/local/bin/npx-for-claude. Might need to riff on it if you use bash, but this works for me. Now I can do something like this in my config:
{
"mcpServers": {
"everything": {
"command": "npx-for-claude",
"args": ["-y", "@modelcontextprotocol/server-everything"]
}
}
}
Have only tested that this works with fnm. Not sure about nvm.
This worked for me.
Can you please check all versions installed in your NVM? do you have versions less than v18? if yes, try to delete them and run again. For some reasons Claude use the earliest version of node in NVM.
Can confirm, uninstalling older node versions fixed it for me and I was able to setup the MCP with npx instead of global install
@claude could you take a look at the problems and solutions mentioned in this issue and then make a suggestion for what we could include in a troubleshooting guide, for when users encounter these problems when using nvm?
Based on the extensive discussion in this issue, here's my suggested content for a troubleshooting guide for NVM-related MCP server problems:
Detailed Troubleshooting Guide Content
NVM and Node Version Manager Troubleshooting
Root Cause
The primary issue occurs because GUI applications like Claude Desktop don't inherit shell environment variables that NVM requires. When Claude Desktop spawns MCP server processes, it uses spawn() with shell: false, meaning NVM's shell functions and PATH modifications aren't available.
Common Error Messages
Error: spawn npx ENOENT
env: node: No such file or directory
command not found: node
Connection timeouts or MCP servers failing to start
Diagnosis: Which Node Version is Claude Desktop Using?
Add this temporary configuration to identify the problem:
Check your MCP logs after restarting Claude Desktop. You might see Claude Desktop is using an old Node version (often the alphabetically first one in your NVM directory).
Solution 1: Remove Old Node Versions (Simplest)
Most effective solution mentioned by multiple users:
List your installed Node versions:
nvm list
Remove versions older than Node 18:
nvm uninstall v14.x.x
nvm uninstall v16.x.x
# Remove all old versions
Keep only Node 18+ versions
Restart Claude Desktop
Why this works: Claude Desktop appears to use the alphabetically first Node version in the NVM directory. Removing old versions forces it to use a compatible version.
Solution 2: Use Absolute Paths (Most Reliable)
For maximum reliability, use absolute paths to both Node and the globally installed MCP server:
For volta:
Use volta which node and volta which [package] to find paths, then use absolute paths.
Verification Steps
Check MCP logs at:
macOS: ~/Library/Logs/Claude/
Logs should show successful server initialization
Verify in Claude Desktop:
Look for MCP server tools in the attachment menu
Test basic server functionality
When Solutions Don't Work
Ensure you're restarting Claude Desktop after configuration changes
Verify file paths exist and are accessible
Check MCP server logs for specific error messages
Try installing the MCP server globally first (npm install -g [package])
Consider switching to a different Node version manager (mise is mentioned as working better than NVM)
Permanent Solution Recommendation
For the best long-term experience:
Remove old Node versions (< 18) from NVM
Use absolute paths for critical MCP servers
Consider switching to mise as it handles GUI application environments better than NVM
Todo List:
Review all comments to understand the core problems
Categorize different types of issues and their root causes
Identify the most reliable workarounds from user feedback
Create structured troubleshooting guide content
Provide clear step-by-step solutions
This troubleshooting guide covers all the major solutions mentioned in the issue, organized from simplest to most complex, with clear explanations of why each approach works.
@domdomegg do you think troubleshooting docs like what Claude suggested above ^^ should go in this repo, or perhaps in the main MCP documentation instead?
This would appear to be an extremely common issue given the likelihood of Node developers needing to use NVM to manage multiple versions of Node across their projects. Uninstalling the earlier versions of Node is a temporary solution but not permanent since the larger issue is that the version of Node Claude chooses to user when firing the MCP server command is unpredictable and the same issue could reappear.
Checking the macOS client logs, why is the "paths" array that gets resolved in this order to begin with?
This path array looks to not be based on the user's $PATH but embedded into the Claude source. It would probably make sense to reverse the order of NVM versions so that the most recent version resolved first. Correct me if I'm wrong.
Reacted by David, Rafal Zawadzki, Nathan Guenther, Todd Schiller, Niel Thiart, Cory Shaw, Trang Le and Ilja Razinkov
Going to close this issue since its not really a server bug and these comments will still be discoverable in GitHub when the issue is closed. Thanks everyone for the comments and suggestions to help resolve this.
Still hitting this in 2026 with nvm-windows (nvm4w), Node v24.8.0, and Claude Code CLI. The failure is completely silent — ✗ Failed to connect, no errors, server even logs "connected" but never responds on stdout.
Quick diagnostic: If claude mcp list shows .exe-based MCPs working but all npx-based ones failing — you're hitting this.
Fix: Global install + absolute paths in config:
npm install -g <package>@latest
where node # e.g. C:\nvm4w\nodejs\node.exe
npm root -g # e.g. C:\Users\<YOU>\AppData\Roaming\npm\node_modules
Activity
mckaywrigley commentedon Nov 26, 2024
I also ran into issues with the recommended npx setup, and I was able to successfully reproduce this workaround - fixes it completely.
MCPs now install and attach correctly within Claude Desktop.
lborgav commentedon Nov 27, 2024
This workaround works fine
adam91holt commentedon Nov 27, 2024
I can confirm this is working for me too.
You may have a different node.js version installed so just do the following for puppeteer as an example
npm i -g @modelcontextprotocol/server-puppeteer cd /Users/YOUR_USERNAME/.nvm/versions/node ls >>> v14.17.6 v16.19.0 v18.14.0 v18.20.4Then I ended up with this and it works sweet!
{ "mcpServers": { "puppeteer": { "command": "/Users/YOUR_USERNAME/.nvm/versions/node/v18.20.4/bin/node", "args": [ "/Users/YOUR_USERNAME/.nvm/versions/node/v18.20.4/lib/node_modules/@modelcontextprotocol/server-puppeteer/dist/index.js" ] } } }jspahrsummers commentedon Nov 27, 2024
The challenge with NVM is that it seems to mostly work by installing a very complicated shell function into your shell profile. It'd be great if we could figure out your preferred Node version via NVM, but I haven't found a good way to do that—open to ideas!
jspahrsummers commentedon Nov 27, 2024
Cross-linking: see #40 for Windows workaround steps as well
lolochka commentedon Dec 4, 2024
Unfortunately, the issue is still reproducible on Mac with nvm installed.
OS: macOS 15.1.1
Claude: 0.7.5
Locally I have checked that all packages are available with inputted paths.
The SQlite server is working correctly, but tools for server-filesystem doesn't appear
My settings
mlaugharn commentedon Dec 7, 2024
suggestion: the same way that there is the
mcpServersfield, can there also be an egmcpShellfield? Or maybe ashellorsourcekey per individual server, eg"shell": "source /Users/user/mcp.sh"? Might introduce 'too much' flexibility but it could make mcp more usable/transparent to tinker with.daaain commentedon Dec 8, 2024
I was struggling to get MCP working yesterday, the error messages in the logs were unhelpful, and the most confusing of all is that it just started working today. This might not be the repo for this request, but it would be really useful if it was explicily documented which shell Claude Desktop is using to start the MCP services.
To your question @jspahrsummers, wouldn't
nvm alias defaultwork?jspahrsummers commentedon Dec 9, 2024
Unfortunately no, the environment for GUI apps is completely different from what you see on the command line.
daaain commentedon Dec 9, 2024
Ah right, I had a look and to answer my own question, assuming that Claude Desktop's Electron implementation uses the MCP TS SDK, it's node:child_process
spawnwithshell: false.combdn commentedon Dec 9, 2024
In the meantime, I have migrated from NVM to mise, and now, if I start the Claude app from my shell (
open -a Claude), it can correctly use node and npm (it didn’t work with NVM). That might be a workaround for some people with the same problem.PS Apple seems to have removed an option to set up the environment for the GUI apps through the launch agents. But I'm not sure. I didn’t dive too deep into it.
70 remaining items
wrightkhlebisol commentedon Jul 11, 2025
Can confirm, uninstalling older node versions fixed it for me and I was able to setup the MCP with npx instead of global install
Merge pull request modelcontextprotocol#64 from lwsinclair/add-mseep-…
ahmetkca commentedon Jul 30, 2025
Here is what works for me (with mise version manager):
olaservo commentedon Aug 17, 2025
@claude could you take a look at the problems and solutions mentioned in this issue and then make a suggestion for what we could include in a troubleshooting guide, for when users encounter these problems when using nvm?
claude commentedon Aug 17, 2025
Claude finished @olaservo's task —— View job
NVM Troubleshooting Guide Analysis Complete
Based on the extensive discussion in this issue, here's my suggested content for a troubleshooting guide for NVM-related MCP server problems:
Detailed Troubleshooting Guide Content
NVM and Node Version Manager Troubleshooting
Root Cause
The primary issue occurs because GUI applications like Claude Desktop don't inherit shell environment variables that NVM requires. When Claude Desktop spawns MCP server processes, it uses
spawn()withshell: false, meaning NVM's shell functions and PATH modifications aren't available.Common Error Messages
Error: spawn npx ENOENTenv: node: No such file or directorycommand not found: nodeDiagnosis: Which Node Version is Claude Desktop Using?
Add this temporary configuration to identify the problem:
{ "mcpServers": { "debug-node": { "command": "node", "args": ["-v"] } } }Check your MCP logs after restarting Claude Desktop. You might see Claude Desktop is using an old Node version (often the alphabetically first one in your NVM directory).
Solution 1: Remove Old Node Versions (Simplest)
Most effective solution mentioned by multiple users:
List your installed Node versions:
Remove versions older than Node 18:
nvm uninstall v14.x.x nvm uninstall v16.x.x # Remove all old versionsKeep only Node 18+ versions
Restart Claude Desktop
Why this works: Claude Desktop appears to use the alphabetically first Node version in the NVM directory. Removing old versions forces it to use a compatible version.
Solution 2: Use Absolute Paths (Most Reliable)
For maximum reliability, use absolute paths to both Node and the globally installed MCP server:
Install MCP server globally:
Find your Node version:
nvm current # Example output: v22.11.0Configure with absolute paths:
{ "mcpServers": { "filesystem": { "command": "/Users/username/.nvm/versions/node/v22.11.0/bin/node", "args": [ "/Users/username/.nvm/versions/node/v22.11.0/lib/node_modules/@modelcontextprotocol/server-filesystem/dist/index.js", "/path/to/directory" ] } } }Solution 3: Custom NPX Wrapper Script
Create a wrapper script that sources your shell environment:
Create
/usr/local/bin/npx-for-claude:Make executable:
Configure Claude Desktop:
{ "mcpServers": { "filesystem": { "command": "npx-for-claude", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/directory"] } } }Solution 4: PATH Environment Variable
Set explicit PATH in the MCP configuration:
{ "mcpServers": { "filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/directory"], "env": { "PATH": "/Users/username/.nvm/versions/node/v22.11.0/bin:/bin" } } } }Solution 5: Shell Command Wrapper
Use a shell to execute the command:
{ "mcpServers": { "filesystem": { "command": "bash", "args": [ "-c", "source $HOME/.nvm/nvm.sh && nvm use default && npx -y @modelcontextprotocol/server-filesystem /path/to/directory" ] } } }Alternative Version Managers
Similar solutions work for other version managers:
For fnm:
For mise:
{ "command": "mise", "args": ["exec", "node@latest", "--", "npx", "-y", "@mcp-server"] }For volta:
Use
volta which nodeandvolta which [package]to find paths, then use absolute paths.Verification Steps
Check MCP logs at:
~/Library/Logs/Claude/Verify in Claude Desktop:
When Solutions Don't Work
npm install -g [package])Permanent Solution Recommendation
For the best long-term experience:
miseas it handles GUI application environments better than NVMTodo List:
This troubleshooting guide covers all the major solutions mentioned in the issue, organized from simplest to most complex, with clear explanations of why each approach works.
olaservo commentedon Aug 17, 2025
@domdomegg do you think troubleshooting docs like what Claude suggested above ^^ should go in this repo, or perhaps in the main MCP documentation instead?
ifokeev commentedon Aug 18, 2025
Thanks, @olaservo, your insight was really helpful for debugging the problem. The issue was with the node executable path. Here's a workaround:
benknight commentedon Oct 4, 2025
This would appear to be an extremely common issue given the likelihood of Node developers needing to use NVM to manage multiple versions of Node across their projects. Uninstalling the earlier versions of Node is a temporary solution but not permanent since the larger issue is that the version of Node Claude chooses to user when firing the MCP server command is unpredictable and the same issue could reappear.
Checking the macOS client logs, why is the "paths" array that gets resolved in this order to begin with?
This path array looks to not be based on the user's $PATH but embedded into the Claude source. It would probably make sense to reverse the order of NVM versions so that the most recent version resolved first. Correct me if I'm wrong.
olaservo commentedon Oct 29, 2025
Going to close this issue since its not really a server bug and these comments will still be discoverable in GitHub when the issue is closed. Thanks everyone for the comments and suggestions to help resolve this.
fix: MCP install uses absolute paths for nvm users
Ishannaik commentedon Mar 26, 2026
2026 update: definitive Windows + nvm-windows fix
Still hitting this in 2026 with nvm-windows (nvm4w), Node v24.8.0, and Claude Code CLI. The failure is completely silent —
✗ Failed to connect, no errors, server even logs "connected" but never responds on stdout.Quick diagnostic: If
claude mcp listshows.exe-based MCPs working but allnpx-based ones failing — you're hitting this.Fix: Global install + absolute paths in config:
{ "command": "C:\nvm4w\nodejs\node.exe", "args": ["C:\Users\<YOU>\AppData\Roaming\npm\node_modules\<pkg>\<bin-entry>.js", ...] }This bypasses the
.cmdshim and nvm PATH issues entirely.C:\nvm4w\nodejs\node.exeis nvm-windows' symlink that auto-updates onnvm use.Full writeup with root cause analysis + manual handshake verification: ChromeDevTools/chrome-devtools-mcp#182
Sinmson commentedon Aug 5, 2026
For everyone finding this, i solved it with this little trick:
{ "mcpServers": { "angular-cli": { "command": "bash", "args": [ "~/.nvm/nvm-exec", "npx", "@angular/cli", "mcp" ] } } }lajiaojiang-ai commentedon Aug 15, 2026
NVM is still a common reason Desktop/GUI clients show a configured MCP server with zero tools: the GUI process cannot see the nvm
npxshim.I added a local diagnostic that flags this case, plus the related Windows
npxspawn issue from #40:https://github.com/lajiaojiang-ai/mcp-why
Not a replacement for putting a real Node path in the config. It just names the failure instead of leaving people to guess.