The war for your node_modules folder.
"It used to be just npm. Then Yarn made it fast and deterministic. Then pnpm made it efficient. Now everyone is fast. Which one should you type into your terminal?"
I come installed with Node.js. Everyone has me. You don't need to install a package manager to install your package manager. I'm the default.
You waste space! If I have 100 projects using React, npm downloads React 100 times. pnpm stores it once in a global store and hard-links it. I save gigabytes of disk space.
I've improved! `npm ci` gives deterministic builds just like Yarn. And I'm catching up on speed with recent versions. Why use a third-party tool?
pnpm is consistently faster. Installation is parallelized and efficient. And I enforce strict boundaries. npm flattens dependencies, allowing phantom dependencies (accessing packages you didn't install). pnpm prevents that.
Yarn (Berry) is also cool with PnP (Plug'n'Play), removing node_modules entirely. But it breaks compatibility with many tools. npm is the safe path.
pnpm gives you the speed of Yarn and the compatibility of npm, plus disk savings. It's the best of all worlds. Even Next.js and Vue repos have switched to pnpm.
For most developers, `npm` is fine because it's already there. However, `pnpm` is technically superior: it's faster, saves massive amounts of disk space, and prevents dependency hoisting issues. `Yarn` is still solid but `pnpm` has stolen the momentum for efficiency.