I am trying to upgrade my node via homebrew but ran into a problem because I think I tried to download through the website. I am very new to terminal. I\'ve tried to search
If you try to brew link node
and it says something along the lines:
Error: Could not symlink include/node/openssl/archs/aix-gcc/asm/include/openssl/opensslconf.h Target /usr/local/include/node/openssl/archs/aix-gcc/asm/include/openssl/opensslconf.h already exists. You may want to remove it:
Try this:
brew link --overwrite --dry-run node | xargs rm
brew link node
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/include
chown `whoami`:admin /usr/local/include
sudo mkdir /usr/local/lib
chown `whoami`:admin /usr/local/lib
And then to match the other directories in /usr/local I did:
chmod 775 /usr/local/include
chmod 775 /usr/local/lib
then the following worked:
brew uninstall node
brew install node
brew postinstall node
or brew link --overwrite node
doesn't seem to help.
After several rounds of brew uninstall node
and brew install node
the following were the offending directories and files:
sudo rm -r /usr/local/include/node
sudo rm -r /usr/local/share/doc/node
sudo rm -r /usr/local/lib/node_modules
sudo rm /usr/local/lib/dtrace/node.d
sudo rm /usr/local/share/man/man1/node.1
sudo rm /usr/local/share/systemtap/tapset/node.stp
After the offending files are removed brew
will do all the proper linking with permissions for you.
Likely permissions were set as root:wheel
because of a past install with sudo
or perhaps manual installation, etc.
remove the error folder or file manually and run this command brew uninstall node && brew install node
You have to do this process till all error folder and files are removed.
Then node will be linked.
I ran into this same issue under the same circumstances. I was able to get the brew version to install successfully by:
brew install node
/usr/local/include/node
brew uninstall node
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.
brew link --overwrite node
Error: Could not symlink (...)
/usr/xxx
sudo chown -R 'whoami?':admin xxx
brew link --overwrite node
Rinse and repeat