I tried to fix the error where you have to use sudo when running npm. I blindly followed a link to uninstall node, the code was from this gist
After running the command and I tried to install it back with brew: brew install node
. Which gave me the following error:
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/doc/node/gdbinit
/usr/local/share/doc/node is not writable.
You can try again using:
brew link node
Trying to run brew link node
, I got:
Linking /usr/local/Cellar/node/5.4.0...
Error: Could not symlink share/systemtap/tapset/node.stp
/usr/local/share/systemtap/tapset is not writable.
Then when I write brew install npm
, I get:
Warning: node-5.4.0 already installed, it's just not linked
When I write npm -v
I get:
env: node: No such file or directory
Any ideas on how to solve this?
brew remove node
, then reinstalling.brew remove node
didn't work. Installing brew again still gives the link errorbrew doctor
and see what warnings you get. Sounds like permissions may have been changes. I would also try manually deleting the/usr/local/Cellar/node/
folder if hombrew cannot remove it.sudo chown -R $USER /usr/local
and thanbrew link node
. Is this a valid fix? Should I give it as an answer or just delete the question?