-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
fix: "Unable to obtain node version." in git bash windows #3419
Conversation
$ nvm install-latest-npm Attempting to upgrade to the latest working version of npm... Unable to obtain node version.
That doesn’t make sense - if |
Either way, the windows version of node shouldn’t be in play here, since if you’re using nvm, the entire point is to install a no -windows version of node. |
I haven't been able to figure out why it works with command either. There's only nvm node installed on my system, the is no windows version, other than the ones installed by nvm.
|
ah, well that's expected since |
what does |
You're right $ which node
/c/Users/sriram1001/portable_apps/.nvm/versions/node/v18.20.2/bin/node I'm not sure what winpty is, I get the following output $ type -a node
node is aliased to `winpty node.exe'
node is /c/Users/sriram1001/portable_apps/.nvm/versions/node/v18.20.2/bin/node |
so that alias - probably in a shell profile file - is what's causing the problem. |
I only have one |
Looks like its an alias added by git bash. Adding https://stackoverflow.com/a/44835766/8478131 Thanks @ljharb |
Fixes "Unable to obtain node version." error in git bash (for windows). running
npm --version
withoutcommand
does not print anything to stdout.running
nvm_echo "$(command where node)"
gives the windows path, like so:C:\Users\user\portable_apps\.nvm\versions\node\v18.20.2\bin\node.exe
. It might be the cause.Its a stretch, but this could also be related to #2780