💭 node.js - How to fix npm throwing error without sudo - Stack O... =================================================================== !https://stackoverflow.com/questions/16151018/how-to-fix-npm-throwing-error-without-sudo#answer-41395398 Date: April 9, 2024 How to fix npm throwing error without sudo I just installed node and npm through the package on nodejs.org, and whenever I try to search or install something with npm, it throws the following error unless I sudo the command. I have a feeling Stack Overflow · stackoverflow.com [1] Its sad that this is not the accepted answer. ``` bash mkdir ~/.npm-global export NPM_CONFIG_PREFIX=~/.npm-global export PATH=$PATH:~/.npm-global/bin ``` !!! note This post is a thought [2]. It's a short note that I make about someone else's content online #thoughts [3] References: [1]: https://stackoverflow.com/questions/16151018/how-to-fix-npm-throwing-error-without-sudo#answer-41395398 [2]: /thoughts/ [3]: /tags/thoughts/