can't brew install node
There are two steps involved.
- Simply run these four commands:
sudo chown -R `whoami`:admin /usr/local/include/node sudo chown -R `whoami`:admin /usr/local/bin sudo chown -R `whoami`:admin /usr/local/share sudo chown -R `whoami`:admin /usr/local/lib/dtrace
- Finally, run the overwrite command:
brew link --overwrite node
I ran into this same issue under the same circumstances. I was able to get the brew version to install successfully by:
- Run
brew install node
- Make note of the module that is causing the issue and delete it. In your case, this would be
/usr/local/include/node
- Uninstall -
brew uninstall node
- Re-install -
brew install node
I had to repeat this process a few times for each remaining problematic directory (about 3 different ones in actuality), and the install eventually succeeded without any issues.
I ran into this problem on a new MacBook Pro on Mac OS High Sierra. I gleaned brew was trying to use directories named include and lib under /usr/local that was not there. Since root owns /usr I had to do it manually - making sure that whoami
owner matches peer directories in /usr/local:
sudo mkdir /usr/local/includechown `whoami`:admin /usr/local/include sudo mkdir /usr/local/libchown `whoami`:admin /usr/local/lib
And then to match the other directories in /usr/local I did:
chmod 775 /usr/local/includechmod 775 /usr/local/lib
then the following worked:
brew uninstall node brew install node