-
Notifications
You must be signed in to change notification settings - Fork 680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
npx-related mcp server failed to load on nvm env #436
Comments
same issue like: |
MCP Server Commands PATH Environment Investigation ReportIssue DescriptionThe MCP Server Commands environment cannot directly access Node.js executables installed via nvm, unless they are symlinked to the Current WorkaroundCurrently, we're using symbolic links to make Node.js commands accessible: # Create symbolic links from nvm-installed Node.js to Homebrew bin directory
ln -s ~/.local/share/nvm/v22.12.0/bin/npx /opt/homebrew/bin/npx
ln -s ~/.local/share/nvm/v22.12.0/bin/npm /opt/homebrew/bin/npm
ln -s ~/.local/share/nvm/v22.12.0/bin/node /opt/homebrew/bin/node
# Verify the links
$ ls -l /opt/homebrew/bin/npx
lrwxr-xr-x@ 1 donghao admin 48 Dec 29 10:50 /opt/homebrew/bin/npx -> /Users/donghao/.local/share/nvm/v22.12.0/bin/npx While this workaround is functional, it's not an ideal solution as it requires manual intervention and maintenance. Investigation Process1. Initial Environment AnalysisChecked current shell and environment settings: $ echo $0
/bin/sh
$ env
SHELL=/opt/homebrew/bin/fish
PATH=/Users/donghao/.npm/_npx/d597531c0c0615ae/node_modules/.bin:/node_modules/.bin:/Users/donghao/.local/share/nvm/v22.12.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/usr/local/bin:/opt/homebrew/bin:/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin 2. Homebrew Path InvestigationAnalyzed Homebrew's installation script to understand how it manages PATH:
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ brew shellenv
export HOMEBREW_PREFIX="/opt/homebrew";
export HOMEBREW_CELLAR="/opt/homebrew/Cellar";
export HOMEBREW_REPOSITORY="/opt/homebrew";
PATH="/opt/homebrew/bin:/opt/homebrew/sbin:$PATH"; export PATH; 3. Environment Configuration Attempts
$ echo $HOME
/Users/donghao
$ cat ~/.profile
. "$HOME/.cargo/env"
$ echo 'export PATH="/Users/donghao/.local/share/nvm/v22.12.0/bin:$PATH"' >> ~/.profile
$ cat ~/.cargo/env
#!/bin/sh
case ":${PATH}:" in
*:"$HOME/.cargo/bin":*)
;;
*)
export PATH="$HOME/.cargo/bin:$PATH"
;;
esac 4. Configuration Verification
# Current content of ~/.profile
export PATH="/Users/donghao/.local/share/nvm/v22.12.0/bin:$PATH"
. "$HOME/.cargo/env"
$ echo $PATH
# Shows PATH without new additions
$ source ~/.profile
$ echo $PATH
/Users/donghao/.cargo/bin:/Users/donghao/.local/share/nvm/v22.12.0/bin:/Users/donghao/.npm/_npx/d597531c0c0615ae/node_modules/.bin:/node_modules/.bin:/Users/donghao/.local/share/nvm/v22.12.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/usr/local/bin:/opt/homebrew/bin:/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin Technical Findings
Questions for Developers
Possible Solutions
Next StepsWe seek developers' input on:
|
Describe the bug
I am using fish on macos. Previously node was installed by brew and mcp on claude desktop works fine. but it's failed since I got node from fish verion nvm.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
mcp servers should be loaded successful.
Logs
Additional context
it resume to work after switching to brew version node
The text was updated successfully, but these errors were encountered: