// first download "n"
npm install -g n
// then run command to switch to specific node version
n 14.18.0
brew update
brew upgrade node
//On Linux/Mac:
//The module n makes version-management easy:
sudo npm install n -g
//For the latest stable version:
sudo n stable
//For the latest version:
sudo n latest
// use brew to upgrade node to the latest version
brew update
brew upgrade node
node --version // outputs: v12.x.x
// also you can do it with npn
sudo npm cache clean -f // clean first
sudo npm install -g n // install globally
sudo n stable/lts