Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can't brew install node

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 for answers but many people say you can just delete the unbrewed header files. I am not sure how to do that. but for some reason when I try to brew install node, it says the brew link step did not complete successfully.

I also tried to brew link node but that doesn't work either. I ran out of options so I came here.

[SICNARF@WOPR ~]$ brew install node
==> Downloading https://homebrew.bintray.com/bottles/node-0.12.7.yosemite.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/node-0.12.7.yosemite.bottle.tar.gz
==> Pouring node-0.12.7.yosemite.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink include/node/android-ifaddrs.h
/usr/local/include/node is not writable.

You can try again using:
  brew link node
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall node`
==> Summary
🍺  /usr/local/Cellar/node/0.12.7: 2726 files, 31M

this is what happens when i brew doctor

[SICNARF@WOPR ~]$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
    /usr/local/include/node/ares.h
    /usr/local/include/node/ares_version.h
    /usr/local/include/node/libplatform/libplatform.h
    /usr/local/include/node/nameser.h
    /usr/local/include/node/node.h
    /usr/local/include/node/node_buffer.h
    /usr/local/include/node/node_internals.h
    /usr/local/include/node/node_object_wrap.h
    /usr/local/include/node/node_version.h
    /usr/local/include/node/openssl/aes.h
    /usr/local/include/node/openssl/asn1.h
    /usr/local/include/node/openssl/asn1_mac.h
    /usr/local/include/node/openssl/asn1t.h
    /usr/local/include/node/openssl/bio.h
    /usr/local/include/node/openssl/blowfish.h
    /usr/local/include/node/openssl/bn.h
    /usr/local/include/node/openssl/buffer.h
    /usr/local/include/node/openssl/camellia.h
    /usr/local/include/node/openssl/cast.h
    /usr/local/include/node/openssl/cmac.h
    /usr/local/include/node/openssl/cms.h
    /usr/local/include/node/openssl/comp.h
    /usr/local/include/node/openssl/conf.h
    /usr/local/include/node/openssl/conf_api.h
    /usr/local/include/node/openssl/crypto.h
    /usr/local/include/node/openssl/des.h
    /usr/local/include/node/openssl/des_old.h
    /usr/local/include/node/openssl/dh.h
    /usr/local/include/node/openssl/dsa.h
    /usr/local/include/node/openssl/dso.h
    /usr/local/include/node/openssl/dtls1.h
    /usr/local/include/node/openssl/e_os2.h
    /usr/local/include/node/openssl/ebcdic.h
    /usr/local/include/node/openssl/ec.h
    /usr/local/include/node/openssl/ecdh.h
    /usr/local/include/node/openssl/ecdsa.h
    /usr/local/include/node/openssl/engine.h
    /usr/local/include/node/openssl/err.h
    /usr/local/include/node/openssl/evp.h
    /usr/local/include/node/openssl/hmac.h
    /usr/local/include/node/openssl/idea.h
    /usr/local/include/node/openssl/krb5_asn.h
    /usr/local/include/node/openssl/kssl.h
    /usr/local/include/node/openssl/lhash.h
    /usr/local/include/node/openssl/md4.h
    /usr/local/include/node/openssl/md5.h
    /usr/local/include/node/openssl/mdc2.h
    /usr/local/include/node/openssl/modes.h
    /usr/local/include/node/openssl/obj_mac.h
    /usr/local/include/node/openssl/objects.h
    /usr/local/include/node/openssl/ocsp.h
    /usr/local/include/node/openssl/opensslconf.h
    /usr/local/include/node/openssl/opensslv.h
    /usr/local/include/node/openssl/ossl_typ.h
    /usr/local/include/node/openssl/pem.h
    /usr/local/include/node/openssl/pem2.h
    /usr/local/include/node/openssl/pkcs12.h
    /usr/local/include/node/openssl/pkcs7.h
    /usr/local/include/node/openssl/pqueue.h
    /usr/local/include/node/openssl/rand.h
    /usr/local/include/node/openssl/rc2.h
    /usr/local/include/node/openssl/rc4.h
    /usr/local/include/node/openssl/ripemd.h
    /usr/local/include/node/openssl/rsa.h
    /usr/local/include/node/openssl/safestack.h
    /usr/local/include/node/openssl/seed.h
    /usr/local/include/node/openssl/sha.h
    /usr/local/include/node/openssl/srp.h
    /usr/local/include/node/openssl/srtp.h
    /usr/local/include/node/openssl/ssl.h
    /usr/local/include/node/openssl/ssl2.h
    /usr/local/include/node/openssl/ssl23.h
    /usr/local/include/node/openssl/ssl3.h
    /usr/local/include/node/openssl/stack.h
    /usr/local/include/node/openssl/symhacks.h
    /usr/local/include/node/openssl/tls1.h
    /usr/local/include/node/openssl/ts.h
    /usr/local/include/node/openssl/txt_db.h
    /usr/local/include/node/openssl/ui.h
    /usr/local/include/node/openssl/ui_compat.h
    /usr/local/include/node/openssl/whrlpool.h
    /usr/local/include/node/openssl/x509.h
    /usr/local/include/node/openssl/x509_vfy.h
    /usr/local/include/node/openssl/x509v3.h
    /usr/local/include/node/pthread-fixes.h
    /usr/local/include/node/smalloc.h
    /usr/local/include/node/stdint-msvc2008.h
    /usr/local/include/node/tree.h
    /usr/local/include/node/uv-aix.h
    /usr/local/include/node/uv-bsd.h
    /usr/local/include/node/uv-darwin.h
    /usr/local/include/node/uv-errno.h
    /usr/local/include/node/uv-linux.h
    /usr/local/include/node/uv-sunos.h
    /usr/local/include/node/uv-threadpool.h
    /usr/local/include/node/uv-unix.h
    /usr/local/include/node/uv-version.h
    /usr/local/include/node/uv-win.h
    /usr/local/include/node/uv.h
    /usr/local/include/node/v8-debug.h
    /usr/local/include/node/v8-platform.h
    /usr/local/include/node/v8-profiler.h
    /usr/local/include/node/v8-testing.h
    /usr/local/include/node/v8-util.h
    /usr/local/include/node/v8.h
    /usr/local/include/node/v8config.h
    /usr/local/include/node/v8stdint.h
    /usr/local/include/node/zconf.h
    /usr/local/include/node/zlib.h

Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:

    node
[SICNARF@WOPR ~]$ brew link
This command requires a keg argument
[SICNARF@WOPR ~]$ brew link node
Linking /usr/local/Cellar/node/0.12.7... 
Error: Could not symlink include/node/android-ifaddrs.h
/usr/local/include/node is not writable.
like image 931
Francis Avatar asked Jul 29 '15 05:07

Francis


People also ask

Can I install node with Homebrew?

Use Homebrew to install Node. js on MacOS. Homebrew is a better way to manage various packages on your Mac.

How long does brew install node take?

The make install step takes about 20-25 minutes.


3 Answers

There are two steps involved.

  1. 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  
  1. Finally, run the overwrite command:
    brew link --overwrite node 
like image 106
Sahil Chhabra Avatar answered Oct 03 '22 01:10

Sahil Chhabra


I ran into this same issue under the same circumstances. I was able to get the brew version to install successfully by:

  1. Run brew install node
  2. Make note of the module that is causing the issue and delete it. In your case, this would be /usr/local/include/node
  3. Uninstall - brew uninstall node
  4. 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.

like image 41
Brad Avatar answered Oct 03 '22 01:10

Brad


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
like image 36
JimTri Avatar answered Oct 03 '22 00:10

JimTri