How can I downgrade NodeJS? / How to install a specific NodeJS version?

How can I downgrade the preinstalled NodeJS version?

On the Mac stacks

NodeJS is installed with brew. The first step should be to remove the preinstalled NodeJS version:

brew uninstall node

After this you just have to install the version you want to. This can usually be done with brew, although the package/formulae versioning did change recently; something like:

brew install node@6

# this might be optional
brew link --force node@6

Should work for the versions which are available in brew (run brew search node on your Mac to search which versions are available).

Alternatively, and for versions which are not available in brew, you can use the official one liner (, tweaking the version number a bit:

set -ex

# remove previous version
brew uninstall --ignore-dependencies node

# install older / other version
# you can see all the available versions at:
curl "${NODE_VERSION}/node-v${NODE_VERSION}.pkg" > "$HOME/Downloads/node-installer.pkg"
sudo installer -store -pkg "$HOME/Downloads/node-installer.pkg" -target "/"

On the Android/Linux stacks

Same thing, first uninstall the current version then install the new one. Using the official one-liners for Debian/Ubuntu (

set -ex

# remove previous version
sudo apt-get remove -y nodejs

# install older / other version
curl -sL | sudo -E bash -
sudo apt-get install -y nodejs

I had to make a slight modification for it to work for me:

brew uninstall --ignore-dependencies node
brew install node@8
brew link --overwrite --force node@8 

For me, I had to use link, and I also had to add --overwrite to it. I had to implement this because a particular dependency in my package.json required an LTS version of node.


Thanks for sharing @ntomallen! :wink: