• Register
0 votes
472 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?

6 5 3
7,540 points

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.

9 7 4
38,600 points

Related questions

0 votes
2 answers 376 views
376 views
Problem : I want to to run my NodeJS version with the nvm but getting following error: $ nvm use v4.2.4 nvm is not compatible with the npm config "prefix" option: currently set to "/Users/z/.npm-global"Run `npm config delete prefix` or `nvm use --delete- ... it. I have set the prefix on purpose to avoid the sudo npm How can I use nvm without losing the prefix for my globally installed packages?
asked Nov 29, 2019 alecxe 7.5k points
0 votes
1 answer 300 views
300 views
Problem : Currently I am learning Homebrew (Mojave). Recently I tried to install the node using Homebrew (Mojave) but after sometime my Php stopped working and now if I try to run the command php -v I face below error: php -v dyld: Library not loaded: /usr/local ... from: /usr/local/bin/php Reason: image not found I have also tried to uninstall my both node and icu4c but my problem still persists
asked Feb 20 mphil 2.3k points
0 votes
1 answer 600 views
600 views
Problem : I am new to npm and now I am facing strange looking below error “Error: EACCES: permission denied, access '/usr/local/lib/node_modules'” Detailed error as below: npm ERR! path /usr/local/lib/node_modules npm ERR! code EACCES npm ERR! errno -13 npm ... code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/usr/local/lib/node_modules' } Have somebody fixed this before?
asked Feb 20 mphil 2.3k points
0 votes
1 answer 112 views
112 views
Problem : I am facing issues while building an app as node-sass keeps giving the following error : node sass could not find a binding for your current environment: os x 64-bit with node.js 8.x
asked Nov 15, 2019 peterlaw 6.9k points
0 votes
1 answer 11 views
11 views
Problem: I am very new to cordova, phonegap, ant,sdk,jdk. I am learning to use phonegap/cordova. Everything is installed properly on my machine i.e cordova, phonegap, ant,sdk,jdk. But now suddenly it started saying that: "’Node' is not recognized as an ... insufficient knowledge I am unable to fix this issue. I am looking for cordova and phonegap experts who can help me in fixing this issue.
asked Sep 2 Raphael Pacheco 4.9k points