Reputation: 2119
I was trying to install yeoman but it threw an error regarding self signed certificates.
I looked this up and I found out I had to upgrade node.
Upgrading node however threw this: (forgot to use sudo with it...)
npm ERR! error rolling back Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR! error rolling back [email protected] { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm']
After this I couldn't use npm anymore. It couldn't be found:
/usr/local/bin/npm: No such file or directory
Trying to reinstall with brew:
It appears you already have npm installed at /usr/local/lib/node_modules/npm
Tells me to npm uninstall but I can't use npm anymore.
The error message is more detailed but I think the part about "unlinking" is the main thing. How do I go about linking it back up and also why was such a weird error thrown?
EDIT: also ran npm config set ca ""
before trying to update node.
Upvotes: 17
Views: 20443
Reputation: 170
sudo brew postinstall command works for me. This issue is caused if you try to update a core NPM package without using the sudo command
Upvotes: 2
Reputation: 664
I installed using brew after: brew install node
sudo brew postinstall node
Upvotes: 27
Reputation: 2119
Found some links with similar errors and all with different solutions:
https://github.com/npm/npm/issues/4099
Error: The 'brew link' step did not complete successfully
How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)
The answer for the third one helped most I think, specifically:
go to /usr/local/lib and delete any node and node_modules
Upvotes: 9