node.xx already installed, it’s just not linked. Brew error

I’ve been trying to install node using brew on Mac and encountered an error.


brew install node
==> Downloading https://homebrew.bintray.com/bottles/node-6.8.1.el_capitan.bottle.tar.gz
Already downloaded: /Users/kalmario/Library/Caches/Homebrew/node-6.8.1.el_capitan.bottle.tar.gz
==> Pouring node-6.8.1.el_capitan.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/doc/node/gdbinit
Target /usr/local/share/doc/node/gdbinit
already exists. You may want to remove it:
  rm '/usr/local/share/doc/node/gdbinit'

To force the link and overwrite all conflicting files:
  brew link --overwrite node

To list all files that would be deleted:
  brew link --overwrite --dry-run node

Fixing the link issue

First is to change the /usr/local permission to your user

 sudo chown -R `kalmario` /usr/local/

Force the link between node and /usr/local

brew link --overwrite node

Execute the post install

brew postinstall node

And you are done!

Leave a Reply

Your email address will not be published. Required fields are marked *

*