nvm-sh / nvm

Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions
MIT License
78.92k stars 7.9k forks source link

unable to install nvm #3406

Open Johnfarcy opened 1 month ago

Johnfarcy commented 1 month ago

Operating system and version:

nvm debug output:

command not. found

nvm ls output:

command not found

How did you install nvm?

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash

output -- Error: the install instructions explicitly say to pipe the install script to bash; please follow them

What steps did you perform?

What happened?

bash has been depreciated on Mac

What did you expect to happen?

Is there anything in any of your profile files that modifies the PATH?

the usual instructions as mentioned

ljharb commented 1 month ago

bash has not been deprecated on Macs, it's just no longer the default shell. What Mac OS version are you using?

Johnfarcy commented 1 month ago

my bad. bash does exist but this isn't working. Sonoma

ljharb commented 1 month ago

I have Sonoma and it works fine. Are you sure you're not doing anything in bashrc or bash_profile that might make the install script not realize it's bash? What does which bash say?

Johnfarcy commented 1 month ago

/bin/bash bashrc and bash_profile - I added- this.

export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion '' default shell is zsh

ljharb commented 1 month ago

is there anything else in those two files?

Johnfarcy commented 1 month ago

no

ljharb commented 1 month ago

what does echo "|$BASH_VERSION|$ZSH_VERSION|" print out?

Johnfarcy commented 1 month ago

5.9

ljharb commented 1 month ago

… just that? my command includes three pipe characters

Johnfarcy commented 1 month ago

this is the output ||5.9|

ljharb commented 1 month ago

ah right, in zsh that's expected - what if you run bash -c 'echo "|$BASH_VERSION|$ZSH_VERSION|"'?

Johnfarcy commented 1 month ago

ohh , this is the output for that .. |3.2.57(1)-release||

ljharb commented 1 month ago

hm, ok, that's the same output i get - but given that output, the install script should be working fine. I'm pretty confused.

ljharb commented 2 weeks ago

Can you try v0.40.1 ? It's possible that some fixes in there will address this.

roni-estein commented 6 days ago

bash -c 'echo "|$BASH_VERSION|$ZSH_VERSION|"'

Hey I had the same output, on an apple M1, but this might be of interest for you. I had an alias for a command not in use on my system

"shift" took me to a directory in my codebase where I was migrating another older different project on a service called shift of course. I noticed that the ls and ls-remote hung but also moved me to that project after [ctrl + c] when I re-aliased that command to something else ls worked again.

I didn't source dive the code, but when I write public consumed packages I often declare and unset my commands locally for just that reason, however, that can have some side effects depending on the system so sometimes scoping them with weird namespace name like nvm:internals:shift might reduce or eliminate collisions.

Anyhow I hope that helps someone!

ljharb commented 6 days ago

Certainly you can override shell builtins, but you also never should. If you override shift, then I'd expect lots of thizngs to break in novel ways. Thanks for clearing that up!