I think you missed this step:
source ~/.nvm/nvm.sh
You can run this command on the bash OR you can put it in the file /.bashrc or ~/.profile or ~/.zshrc to automatically load it
https://github.com/creationix/nvm
Answer from Deepak Lamichhane on Stack OverflowI think you missed this step:
source ~/.nvm/nvm.sh
You can run this command on the bash OR you can put it in the file /.bashrc or ~/.profile or ~/.zshrc to automatically load it
https://github.com/creationix/nvm
Check your .bash_profile, .zshrc, or .profile file. You most likely had a problem during the installation.
You should have the following at the end of one of those files.
[[ -s $HOME/.nvm/nvm.sh ]] && . $HOME/.nvm/nvm.sh # This loads NVM
The . $HOME/.nvm/nvm.sh is the same as source $HOME/.nvm/nvm.sh
See: Sourcing a File
You can also check to see if you have a .nvm folder.
ls -a | grep .nvm
If you're missing that folder then the installation failed to run the git command. This could be due to being behind a proxy. Try running the following instead.
git clone http://github.com/creationix/nvm.git .nvm
zsh: command not found: nvm
How to properly install nvm Mac when it's already installed but not recognized? - LambdaTest Community
python - Unable to use nvm install on MacOS: 'zsh: command not found: nvm' - Stack Overflow
zsh: command not found: node
Videos
Added this line to ./zshrc file. Working great. Original source: https://github.com/lukechilds/zsh-nvm
export NVM_DIR=~/.nvm
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
I was having the same problem after exiting the terminal the nvm command was not found. So to fix this you have to add
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
this line of code on your .zshrc file
to do that type vim ~/.zshrc than add the following lines in the bottom and to save the file click ctrl than press :wq! to save file in vim you can also use nano
When I installed VSCode, oh-my-zsh and NVM using homebrew I had the same issue. It appears to put wrong paths in ~/.zshrc (might be the same for bash).
Solution:
- Open ~/.zshrc or ~/.bashrc
- Create a backup of that file in case something goes wrong
- Compare paths under the line
export NVM_DIR="$HOME/.nvm"
- Now you need to fix the two paths if different than those below
[ -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
- Type
source ~/.zshrcorsource ~/.bashrcin terminal depending on what you use. - Restart VSCode built-in terminal and see if that helped. Good luck!
I also had the same issue after installing nvm and tried to run nvm command in VS Code terminal. This is how I solve it:
Prerequisites:
- macOS Sonoma v14.0
- already install Homebrew (mine is v4.1.14)
Steps:
- Right after installing nvm with brew, create a .nvm folder
mkdir .nvm - Create a .zshrc file in Home directory, same as .nvm
- Open and add this code below to the .zshrc file
source $(brew --prefix nvm)/nvm.sh
- Back to terminal, execute the .zshrc by running
source ~/.zshrc - Restart the VS Code and try to run a nvm command
May this help you!
The problem seems to be that gnome terminal does not load ~/.profile on startup, and there is where NVM is added to the path. You have two choices:
- Go to "Edit" -> "Profile Preferences" in terminal and activate "Run command as a login shell". Then close and open again the terminal.
Add this at the end of
~/.bashrc:[[ -s /home/$USER/.nvm/nvm.sh ]] && . /home/$USER/.nvm/nvm.sh
i think you have miss this step
source ~/.nvm/nvm.sh
You can run this command on the bash OR you can but under the file /.bashrc or ~/.profile to automatically load
REF::https://github.com/creationix/nvm