npm is the default Package manager for the JavaScript runtime environment Node.js.

Since I am stepping out of bounds with this blog, the reader should know that, before reading it. NPM is a very important tool, it does an invaluable service - perhaps for the entire javascript ecosystem. It deserves appreciation, not rants, in most respects? 

This is my experience only, and in the fall of 2015 only. Hopefully your experience will be quite different, and this blog will stick out as an anomaly in the history of javascript and node js, more specifically.

I am not a javascript programmer in any normal sense. I wrote one javascript program. One. I'm not even a good UI programmer by any reasonable standard. I'm a back-end java guy who strayed, perhaps where he didn't belong, for a few months - part time.

Friends Don't Let Friends

In fall 2015, NPM is a necessary requirement for Polymer Starter Kit, unless you want to use the light version. Since I wanted to immerse myself in the full Polymer experience, that meant I needed to use NPM to follow the instructions on the opening README, and download gulp and bower to finish the installation and use the tools as required.

Then I had to use it again a few months later, to download the starter kit in a new version.

Both times it took me days to get through the experience. Days I didn't have, and since I'm a js newbie, I blamed myself at first. But then I discovered later that this is basically a 2 minute process, and I had just been very unlucky. Two of two times.

NPM Hangs

NPM hangs are easy to find in a google search, going back for years. You wouldn't think that would make sense - NPM is so important to so many people, and there are some outdated and also helpful suggestions for getting past this roadblock. 

Here's the deal. If it would just hang you would go away. But instead it hangs but teases you on. Use many of the tricks, or just run it again, and you can probably get it to go through a gulp install, eventually. Keep trying.

NPM hangs are not all created equal. Some are caused by a dependency problem such as mis-matching competing versions, others happen only at certain times (maybe the npm servers need to be rebooted?). So if you are a big dummy like me WHO HAS NO OTHER WAY TO FINISH INSTALLING POLYMER you're going to keep trying something, anything, to get through.

One of the many tricks that I used was to get to a hang, and then manually run npm install on the last package that npm hung on. Maybe 30 or 40 manual installs later, you might get all of gulp downloaded.

If you are laughing at me for being a dumbass, I deserve the laughter. But I was determined.

Ubuntu and NPM not so friendly?

I ran into some special tricks that I had to learn because Ubuntu and NPM apparently don't play nicely together. You guys did know that this was 2015, right? Seemed improbable, but that was my experience.

NPM free service with free support - Amazing!

Wow. Was I ever flabbergasted when I finally ended up pinging npm email support. Friendly? Super-friendly. Helpful? Couldn't have had a better attitude. How cool was this? A free dependency with free support?

Unfortunately, by the time I actually got a response I had already spent days, and the second time moved on to alternate means of aquiring Polymer code dependencies.

Two observations, perhaps both unfair. 

  1. The vendor who referred me to node for support was way too quick to do so. It was his dependency, after all, that was banging when I ran npm. That made me curious - is this something that he is accustomed to doing? It was just too quick - as if this happened constantly or something.
  2. The company providing free support for a free product that an entire subset of the industry depends on seems to have no incentive for fixing these problems? If so, hiring programmers to fix the problem instead of amazing support staff - well, nevermind.

The Best Solution for NPM Hangs? Go Away.

Don't ping support. Don't keep trying. Don't try special tricks (like running in debug mode?). Simply go away. Do another project. Visit your ailing grandfather in another city. Read a technical article that takes days to get through, anything. Because they will probably reboot the servers in the next few days, [or some other magic which I don't know] and your problem will be fixed.

Good luck if you're a contractor on a deadline. Or if you've devoted only that one weekend to learn Polymer, and it's the last free weekend you will have for a couple months. Nope, if it's Polymer Starter Kit, you have to use the light version. That requires no NPM install. You won't miss it much, I promise.

Pull Requests Welcome:

Goes without saying that instead of writing a blog, maybe I should have tried to fix the problems? Node is open source.

It normally isn't an issue to have comments turned off on my blog, but then again I'm not usually flaming great vendors like node, either. So I should at least explain that I turned off comments 5 years ago because I wasn't willing to keep up with the output of the ever productive spam bots.

Generally uncool to flame an open source vendor and not have comments turned on. But that's what I did.