Programmers learn & share
0 votes
223 views

Problem :

I made the big mistake of trying remove all sudo dependencies. I simply downloaded npm as a package from the preferred site and did a manual global install. But I had to always run with the sudo. That’s why I tried to uninstall and tried to run it with homebrew.

Now the problem is I cannot even get node or npm to run. I think I need to link with brew link but I am getting following 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'

I have also tried to remove that: And now I am getting permission denied.

I have tried to run brew prune also I have uninstalled and then reinstalled using following steps:

$ brew uninstall npm
$ brew uninstall node
$ npm uninstall npm -g
$ sudo rm -rf /usr/local/lib/node_module

Also I am running Yosemite 10.10.5. My git version is 2.6.0 installed. And my homebrew is updated. But still the brew doctor gives me following 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:

Now I am completely stuck and don’t know how to solve it. Does anybody have any clue?

by (7.5k points)   | 223 views

1 Answer

0 votes

Solution :

I can see that several files and directories in your /usr/local are now owned by root, as you have ran a couple of steps using sudo. Now to get rid of these, please take back the ownership of all of the files and directories under your /usr/local by following command:

sudo chown -R $(whoami) $(brew --prefix)/*

Once that is done, Just run brew doctor again. And all your issues will be resolved.

by (36.1k points)  
2,227 questions
2,734 answers
59 comments
241 users