So I made the mistake of trying to get rid of all sudo dependencies. I downloaded npm as a package from the site and did a manual/global install. But it seemed as if i was a
It looks like several files and directories in /usr/local are now owned by root, since you ran a couple of steps using sudo. To get rid of these, take back ownership of all of the files and directories under /usr/local:
sudo chown -R $(whoami) $(brew --prefix)/*
Once that is done, run brew doctor again.
Similar questions can be found here:
In my case, I was continue to execute command brew link node and upon every execution, it is keep on saying to remove some files. I just followed the instructions and keep on removing them with sudo. At last, after 5 such removals, I have the linking done.