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.
Windows Manually Add Node and NPM to Path On Windows, you may face the “npm command not found” error if the path to nodejs and npm are not added to your path variable. To fix this, locate the path to nodejs and npm binaries. The command above should add the specified directory to the path variable.
Go into %ProgramFiles%\nodejs\node_modules\npm and copy the file named npmrc in the new npm folder, which should be %appdata%\npm\node_modules\npm . This will tell the new npm where the global installed packages are.
go to /usr/local/include and delete any node and node_modules directory. if you installed with brew install node, then run brew uninstall node in your terminal. check your Home directory for any local or lib or include folders, and delete any node or node_modules from there.
I installed using brew after: brew install node
sudo brew postinstall node
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With