Instructions that I used to install node recently.
You have homebrew already installed.
We’re going to install nvm, the node version manager (similar to
rbenv). At the time this installed version 0.31. To see the latest
instructions of setting up nvm, type in
brew info nvm.
- Open Terminal
Install nvm via homebrew:
brew install nvm
We want our node versions to be installed to a user local path, so make the folder
~/.nvm. Then append
export NVM_DIR=~/.nvmto your bash profile:
mkdir ~/.nvm echo "export NVM_DIR=~/.nvm" >> ~/.bash_profile
nvmis available from the terminal:
echo ". \$(brew --prefix nvm)/nvm.sh" >> ~/.bash_profile
Reload the bash profile
source ~/.bash_profile or restart the terminal.
Using nvm let us install the latest version. At the time, this was 5.8.0.
nvm install v5
Node that nvm will also make this the default node version which will be available from your PATH.
To see what the latest node version is type in (there may be v6, v7, etc.):
Upgrade to latest npm
Finally, let’s make sure we have the latest npm:
npm install -g npm
And that should be it.