-bash: nvm: command not found

13,346

Solution 1

Type in terminal

source ~/.nvm/nvm.sh
source ~/.profile
source ~/.bashrc

Solution 2

My answer is based on Mac OS X but I am sure it should work for other Linux based system.

Installing & using nvm on Mac OS X

  • Install homebrew from here.
  • Using homebrew install nvm

    brew update brew install nvm

  • Create .nvm directory at ~/.nvm location.

    mkdir ~/.nvm

  • Now if you don't have .bash_profile file setup for OS X terminal then please create a .bash_profile at the root level:

    nano ~/.bash_profile

  • Paste below code in the .bash_profile and press CTRL + O and press enter to save .bash_profile file. Press CTRL + X to exit from editor:

    export NVM_DIR=~/.nvm source $(brew --prefix nvm)/nvm.sh

  • Now either quite (CMD + Q) the terminal or run below command to load .bash_profile settings:

    source ~/.bash_profile

  • Now run nvm ls command to get the list of all installed nodejs versions.

Share:
13,346
WflytoC
Author by

WflytoC

Updated on June 16, 2022

Comments