• Register
0 votes

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

Please log in or register to answer this question.

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
1 answer 27 views
Problem: error: the `brew link` step did not complete successfully.
asked Feb 23 Dan phillip 4.8k points
0 votes
1 answer 395 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, 2020 mphil 2.3k points
0 votes
2 answers 646 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 871 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, 2020 mphil 2.3k points
0 votes
1 answer 214 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 12 views
Problem: node is not recognized as an internal or external command.
asked Feb 23 Ethan ross 2.7k points
0 votes
1 answer 35 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, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 20 views
Problem: module build failed: error: cannot find module 'node-sass'
asked Feb 18 charles mathews 5.5k points
0 votes
1 answer 20 views
Problem : the engine "node" is incompatible with this module.
asked Feb 20 Shovo210 13.8k points
0 votes
1 answer 43 views
Problem: I am a beginner to node.js, cordova and npm.When I try below command: $ npm install -g cordova@latest I always face below error: “Npm WARN deprecated node-uuid@1.4.8: Use uuid module instead.” Below are my system details: mac Os Sierra 10.12 ... each and every suggestion and also tried to install or uninstall the hundred times. I want to know is it a npm or cordova problem?
asked Aug 29, 2020 Raphael Pacheco 4.9k points