Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Brew install nvm. nvm: command not found

Tags:

homebrew

nvm

After installing nvm with brew, and running nvm, it says nvm: command not found

How can I get the command to execute?

like image 780
user3207874 Avatar asked Nov 02 '18 12:11

user3207874


People also ask

How can install NVM in Mac?

Homebrew ( brew ) makes it easy to install and manage versions of nvm . If you have homebrew already available, please run brew install nvm . And you will be all set.

How do I know if NVM is installed on Mac?

Then to check if nvm is properly installed, open a new command prompt terminal and type nvm . Once it is verified that it is installed you can move on to the next step. The version can be a NodeJS version or "latest" (for the latest stable version).


2 Answers

There are two steps to installing nvm with brew.

First use brew to install the application:

brew install nvm

Then take a look at the brew info "caveats" section, to see what else you have to do:

brew info nvm

You might see something like (this can change!):

You should create NVM's working directory if it doesn't exist:    mkdir ~/.nvm  Add the following to ~/.bash_profile or your desired shell configuration file:    export NVM_DIR="$HOME/.nvm"   . "/usr/local/opt/nvm/nvm.sh" 

If you do not have a ~/.bash_profile file, then you can simply create one.

Make sure to restart your terminal before trying to run the nvm command again.

like image 194
user3207874 Avatar answered Sep 20 '22 17:09

user3207874


I followed @user3207874's answer, but it still wasn't working for me. I had to run this command after those steps:

source $(brew --prefix nvm)/nvm.sh 
like image 29
Aaditya Singh Avatar answered Sep 19 '22 17:09

Aaditya Singh