I installed nvm on my Mac using Homebrew.
brew update
brew install nvm
mkdir ~/.nvm
nano ~/.bash_profile
Added below to my .bash_profile
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
Then in my shell
source ~/.bash_profile
echo $NVM_DIR
After doing those steps I installed nodejs using nvm
nvm install v6.11.2
The problem is when I type node it says node: command not found
$ node
$ -bash: node: command not found
How do I make nodejs to work?
Below is my .bash_profile
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
export PATH="/usr/local/bin:$PATH"
#for brew nvm
exportNVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
This is the list of nodejs according to nvm
$ nvm list
v6.11.2
node -> stable (-> v6.11.2) (default)
stable -> 6.11 (-> v6.11.2) (default)
iojs -> N/A (default)
lts/* -> lts/boron (-> v6.11.2)
lts/argon -> v4.8.4 (-> N/A)
lts/boron -> v6.11.2
nvm use --delete-prefix v6.11.2to unset the nvm from '/usr/local/Cellar/nvm/0.33.2/versions/node/v6.11.2' which eventually resolved my issue. You can post your comment as an answer and I will accept it as soon as you do. Thank you.