Homebrew npm install: could not symlink

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:

  • https://apple.stackexchange.com/questions/192227/make-files-in-usr-local-writable-for-homebrew
  • Brew doctor says: "Warning: /usr/local/include isn't writable."

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.

enter image description here