Monday, November 26, 2018

How To Upgrade Node.js To The Latest Version?

If you initially installed Node.js with Homebrew, run:
 brew update
 brew upgrade node
 npm update -g npm

Other Alternatives:
A convenient way to change versions is to use nvm:
 brew install nvm
To install the latest version of Node.js with nvm:
 nvm install node
Upgrading via NPM
You can use the simpler method via the terminal. Avoid using sudo unless you need to.
 sudo npm cache clean -f
 sudo npm install -g n
 sudo n stable 
 sudo n latest
After which you may opt to confirm the upgrade
 node -v