Alright, this is gonna be a big no brainer, but we’ve all spent 1 full hour looking for our glasses, wearing them the whole time, haven’t we?
If you keep getting permission errors whenever you
npm install (even if you’ve fully followed the official guide on how not to get npm permission error), then obviously something is wrong with your machine. Don’t blame npm or nvm!
In my case, it was the
~/.npmrc file. The thing was that I had always been under the impression that this file was “clean” (that it should be in its “good default” state from the beginning), well, until I found out otherwise. The culprit was this line:
Upon commenting out that line, everything worked perfectly fine for me. No more permission error, nada, nil, nilly nada. Funnily enough, when I found out about that, I also recalled that it had been no other than.. me who actually put that line in in the first place. It was probably the noob me playing around with npm settings then gradually forgot that I did so. (~ultra.face.palm~)
Takeaway lesson? We humans tend to ignore what we utterly, completely, comprehensively believe, to the degree that we rarely think about double-checking our own belief. Let’s just say we’re all inherently / unconsciously biased towards our surrounding environment to a certain degree. This is totally fine, but knowing this, we should remind ourselves that it’s fine to doubt ourselves once in a while (esp. when things go wrong). Self-esteem is important, absolute ego is disastrous.