brew install node (if you have brew installed)
npm install -g npm@latest
npm i -g n && n latest
(Node package manager)
(nvm install node –reinstall-packages-from=node)
brew update && brew upgrade node && npm install -g npm
You could install nvm and have multiple versions of Node.js installed.
curl https://raw.github.com/creationix/nvm/master/install.sh | sh
and then run:
nvm install 0.8.22 #(or whatever version of Node.js you want)
you can see what versions you have installed with :
and you can change between versions with:
nvm use 0.8.22
The great thing about using NVM is that you can test different versions alongside one another. If different apps require different versions of Node.js, you can run them both.