What's the difference between NPM and Yarn?

I was asked today, “What’s the difference between NPM and Yarn? When I Google it, I just get results about sewing.”

Great question. Let’s dig in. The server is npmjs.com (though I still use npmjs.org). The clients are two different brands. npm is the original, and made by Joyant when they made node. (Node spun off this way, NPM, Inc. spun off that way.) Facebook got tired of npm being slow and created a “faster” clone called yarn. It uses the same servers, but downloads and caches differently, then installs to the same node_modules folder in the same place. In response, npm upped their game and got faster too. Now to most of us mortals, the two clients are pretty much the same. Both use package.json to know what you’ve already installed, but they keep their shrinkwrap (cache) files differently. For most everyone (myself included) it’s now a preference: use what ever you’d like and it’ll turn out fine.

Here’s the part where I’m sure I’ll get fierce reactions because religious wars are a thing, and under the covers they are incredibly different (cough … Facebook mirror … cough). To them, I say, “You’re right. But from 10,000 feet away, those differences mostly melt away.” (And yes, pnpm is also a thing. So is jspm.)