npm is a great library. It really is. But it has terrible error messages.
The console always says something about finding more information in npm-debug.log, but this information is rarely helpful.
Even if i use –loglevel silly flag, i get dozens of lines that don’t mean much, and then the same meaningless error message i got without using any flag at all.
Googling doesn’t do much good either, because those messages are so generic.
when i couldn’t publish my package today i eventually decided to dive into the npm package to see for myself the line where the code broke.
Instead of looking on my machine, i found it easier to browse the npm github repository and look for the misbehaving line.
Guess what? The line wasn’t there.
Well dah. The npm version i was using turned up to belong in a museum.
OK then, i set out to upgrade npm. shouldn’t be easier. It’s a node package, right?
npm install npm@latest -g should do the trick, right?
Well, not on Windows, apparently.
I came up with this link:
i installed Microsoft’s windows upgrade script, that turned out to be as buggy as you would expect a Microsoft product.
Then I tried doing what the script tried to do manually. This didn’t work either.
Eventually I had to reinstall node.js. That upgraded my npm version, and solved the original problem as well.