node.js install mac

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

  1. sudo npm cache clean -f ———— (force) clear you npm cache
  2. sudo npm install -g n ———install n (this might take a while)
  3. sudo n stable ——— upgrade to lastest version
    node -v

You could install nvm and have multiple versions of Node.js installed.
curl | sh
source ~/.nvm/
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 :
nvm list
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.