How to install specific NodeJS version

I’ve to downgrade to Node 6 because Node 7 which has some bug that I’ve to avoid. It should be easy task but apparently it’s not, even with Homebrew (don’t ask me to use nvm it’s throw error on me so no joy!) and here’s my answer on stack overflow (after try all that but none of them work).

I’ll write it down here too just in case I need it.

Here’s step by step.

To see your current node version

$ node --version

To see available node versions

$ brew search node

To unlink from current version

$ brew unlink node

Install any version e.g. 6

$ brew install node@6

To link installed version

$ brew link node@6

To see your current node version (again)

$ node --version

This take me 30 minutes to figure this out so it’s worth blog it!

Bonus

To revert to current node version (7.5 ATM)

Gotcha

$ brew link --overwrite node
Linking /usr/local/Cellar/node/7.5.0...
Error: Could not symlink share/doc/node/gdbinit

Solution

$ sudo chown -R $USER /usr/local
$
brew link --overwrite node
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.