Node already installed, it's just not linked
I managed to fix this by first running sudo chown -R $USER /usr/local
and following it with brew link node
. Now I have node properly installed.
This solution works! It is a combination of all the combinations.
Fix it using the following code.
sudo chmod 776 /usr/local/lib
brew link --overwrite node
Outputs:
Linking /usr/local/Cellar/node/9.6.1... 49 symlinks created
sudo chmod 755 /usr/local/lib
If you are on High Sierra, then sudo chown -R $USER /usr/local
won't work. Instead use:
sudo chown -R $(whoami) $(brew --prefix)/*
Source: https://github.com/Homebrew/brew/issues/3228#issuecomment-332679274