Skip to content

Unable to link node #9769

@jason-ruby

Description

@jason-ruby

##Brew Doctor
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

##Brew Link
Linking /usr/local/Cellar/node/7.5.0...
Error: 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

##Remove
Unable to remove ( rm '/usr/local/share/doc/node/gdbinit')
sudo unsupported
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.

##Brew Config
HOMEBREW_VERSION: 1.1.9
ORIGIN: https://github.com/Homebrew/brew
HEAD: 664d0c6
Last commit: 9 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: ec560c9
Core tap last commit: 16 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: octa-core 64-bit haswell
Homebrew Ruby: 2.0.0-p648
Clang: 8.0 build 800
Git: 2.11.1 => /usr/local/bin/git
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
Java: N/A
macOS: 10.12.3-x86_64
Xcode: 8.2.1
CLT: N/A
X11: N/A

Activity

dunn

dunn commented on Feb 8, 2017

@dunn
Contributor

Do you know where /usr/local/share/doc/node/gdbinit came from? If you're not worried about deleting it, you can just run brew link --overwrite node, no sudo required.

jason-ruby

jason-ruby commented on Feb 9, 2017

@jason-ruby
Author

Figured it out! TL;DR

Link at end to solution and explanation of what caused issue.
Thank you for the response dunn--I appreciate the assistance! Although it didn't directly help with the solution you responded and caused me to keep digging. Thank you!

Initial

  • No, I don't know where /usr/local/share/doc/node/gdbinit came from.
  • I'm not worried about deleting it.
  • I've tried running brew link --overwrite node without sudo, but get the following error:

Error: Could not symlink share/doc/node/gdbinit
/usr/local/share/doc/node is not writable.

Additional Info Found

I considered deleting ../gdbinit manually...decided that I should get a better idea of what ../gdbinit is and what it is for first.
From a StackOverflow posted question:

".gdbinit" is a file you can drop in your home directory that gdb will parse when gdb launches, either from the command line or from within Xcode.

Background, Cause, and Solution

Activity Leading to Issue

I found a post titled Homebrew npm install: could not symlink on StackOverflow.
The poster had almost identical progression to the same issue:

...made the mistake of trying to get rid of all sudo dependencies. I downloaded npm as a package...did a manual/global install...seemed as if i was always having to run with sudo...so I tried to uninstall and run with homebrew.

Issue(s)

Now I can't get node or npm to even run...I guess I have to link with brew link them but [getting same error]...tried removing that...gotten permission denied...running Yosemite 10.10.5. I have git version 2.6.0 installed. My homebrew is updated. A brew doctor gives me this warning: 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

Cause

Big thank you to nwinkler for his answer to the post with a straight forward explanation:

It looks like several files and directories in /usr/local are now owned by root, since you ran a couple of steps using sudo.

Solution

...and his straight forward solution:

To get rid of these, take back ownership of all of the files and directories under /usr/local:
sudo chown -R $USER /usr/local
Once that is done, run brew doctor again.

Similar questions can be found here:

Thank You!

It worked like a champ!
Although it should have probably been a clear solution, it had been kicking me around pretty well and really getting under my skin.
Thank you again dunn and special thanks to nwinkler for his explanation and solution on StackOverflow.

nkhlmn

nkhlmn commented on Mar 4, 2018

@nkhlmn

I'm having the exact same issue and followed the solution provided here, but it's not working. I still get the following error:

Error: Could not symlink share/doc/node/gdbinit
/usr/local/share/doc/node is not writable.

I also tried the solution/explanation here (i'm on High Sierra), but also no luck:
Homebrew/brew#3228

Anyone have any ideas?

locked and limited conversation to collaborators on May 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @dunn@jason-ruby@nkhlmn

        Issue actions

          Unable to link node · Issue #9769 · Homebrew/homebrew-core