npm vs pnpm vs Yarn: how to choose a JavaScript package manager
All three are current and open source: npm (latest 12.2.3 on its registry) is commonly bundled with Node.js, pnpm 12.21.0 is a Rust rewrite built around a content-addressable store, and Yarn 4.18.1 defaults to Plug'n'Play installs with no node_modules folder. The real differences - disk layout, dependency strictness, monorepo tooling and migration friction - from all three projects' own documentation, read 21 November 2026.
Many JavaScript projects use one of these three without ever making a deliberate choice, because npm arrives bundled with most Node.js installs. As of 21 November 2026, all three are actively shipping: npm 12.2.3 (published 18 November 2026 per the npm registry), pnpm v12.21.0 (13 November 2026 per its GitHub releases) and Yarn 4.18.1 (24 September 2026 per the yarnpkg/berry GitHub releases). All three are open source - Artistic License 2.0, MIT and BSD-2-Clause respectively per their repositories. The choice is not about which is "better"; it is about three different answers to one question: what should installing dependencies actually do to your disk and your dependency rules? This article compares them from all three projects' own documentation, read 21 November 2026, and names no default winner.
What each one is right now
npm is the default: it is commonly bundled with Node.js - the bundled version depends on the Node release and distribution, so check what your install actually carries - which means some version of it is usually already there, and its CLI manages the packages in the registry of the same name. pnpm is a standalone install; version 12, per its own announcement, is a rewrite in Rust that keeps pnpm 11's commands, flags, settings and lockfile format, and adds things like project-aware global runtime shims and normalized Git dependency resolution. Yarn needs a distinction its own docs insist on: there is Yarn Classic (1.x, latest 1.22.22) and Yarn Modern (4.x). Yarn's migration page says the Classic line "remains a pillar of the JavaScript ecosystem" while recommending upgrading to Modern where possible - so treat 1.x and 4.x as two different tools that share a name, and read any Yarn advice against the version it was written for.
The real difference: what an install does to your disk
npm and Yarn Classic both produce a flat, hoisted node_modules directory: every package your dependencies depend on is lifted toward the top level, so your code can accidentally import things you never declared. pnpm's motivation page describes its alternative: one content-addressable store on disk, with installs that hard-link (or copy-on-write clone) files from that store into a non-flat, symlinked node_modules - so 100 projects sharing a dependency keep one copy of its files, and only your declared direct dependencies appear at the top level. That strictness is the point: code that imports an undeclared package fails instead of silently working. If tooling chokes on symlinks, pnpm's nodeLinker=hoisted setting produces an npm-style layout instead. Yarn Modern's default is more radical: Plug'n'Play writes a single .pnp.cjs loader file and no node_modules folder at all, with the same undeclared-dependency protection enforced by the loader - and PnP can be swapped for node_modules or a pnpm-like content-addressed strategy, per Yarn's own migration page.
Everyday workflow and monorepos
The basics are shared: all three work from your package.json, all three write a lockfile (package-lock.json, pnpm-lock.yaml, yarn.lock), and all three support workspaces for monorepos - npm's own docs describe workspaces as its way to manage multiple local packages from one root, and pnpm and Yarn document their own workspace modes. Version management is mostly a Corepack story: per the Node.js documentation, Corepack - the shim that pins and runs the Yarn or pnpm version a project declares - was distributed with Node.js from version 14.19.0 up to, but not including, 25.0.0. On Node 25 and later you install Corepack yourself (npm install -g corepack) and then corepack enable as before; check what your own Node distribution ships rather than assuming either way.
Speed and disk claims, attributed
pnpm's motivation page claims large disk savings and faster installs thanks to the store-and-link design, and Yarn's PnP page claims a minimal install footprint because an install generates the loader file instead of copying trees. These are the vendors' own pages making their own case; third-party benchmarks vary by repository, cache state and CI setup, so the honest move is to measure install time and disk use on your own repo before letting either claim decide anything.
Migration friction, scoped honestly
Switching package managers is more than swapping a lockfile and editing CI commands. Moving to pnpm's strict layout surfaces undeclared dependencies your code was importing by accident - useful, but they arrive as errors to fix. pnpm 12's default strictDepBuilds policy goes further: per its build-settings reference, an install fails with ERR_PNPM_IGNORED_BUILDS when a dependency carries a postinstall build script nobody has ruled on, until you approve or deny it in an allowBuilds map. Moving to Yarn PnP has its own compatibility surface: Yarn's PnP page says most ecosystem tools are designed and tested to work in PnP environments but names React Native / Expo as a notable exception requiring node_modules installs, and ghost-dependency errors are a known adoption friction. Add native-module builds and editor/tooling setup to the list, and the conclusion is: budget real testing time, migrate one project first, and treat the first CI run as part of the migration, not the finish line.
Which one to pick
Tie it to your situation. You want the smallest setup and maximum documentation overlap with random internet answers: npm is already installed on most machines that have Node.js, and it does the job. You manage many projects or a monorepo, care about disk and strict dependency rules, and can absorb the build-script allowlist workflow: pnpm's design targets exactly that. You like the PnP model - no node_modules, instant-feeling installs, strict by construction - and your tooling is compatible: Yarn Modern is built around it, with node_modules still one setting away. On an existing project, the cheapest correct answer is usually the manager the project already pins, via its lockfile or Corepack's packageManager field.
Sources, all read 21 November 2026: pnpm documentation, Motivation (content-addressable store, hard links, three-stage install, non-flat symlinked node_modules, nodeLinker=hoisted fallback - vendor's own claims); pnpm blog, What's different in pnpm 12 (Rust rewrite, stable, keeps pnpm 11 commands and lockfile; project-aware global bins; Git dependency resolution); pnpm documentation, Build Settings (default strictDepBuilds failing on unreviewed dependency build scripts with ERR_PNPM_IGNORED_BUILDS; allowBuilds map); pnpm FAQ (hard-link disk accounting, Windows junctions); npm documentation, Workspaces (multi-package management in the npm CLI); npm registry, npm package metadata (12.2.3 published 18 November 2026); Yarn documentation, Introduction and Yarn documentation, Plug'n'Play (PnP default, .pnp.cjs loader, ghost-dependency protection, React Native/Expo exception); Yarn documentation, Migrating from 1.x (Classic "remains a pillar", upgrading recommended; three install strategies in Modern); Node.js documentation, Corepack (distributed with Node.js 14.19.0 up to but not including 25.0.0; manual install otherwise); GitHub, pnpm releases (v12.21.0, 13 November 2026; MIT) and GitHub, yarnpkg/berry releases (Yarn 4.18.1, 24 September 2026; BSD-2-Clause); npm/cli LICENSE (Artistic License 2.0).
Frequently asked questions
What are the current versions of npm, pnpm and Yarn?
As read on 21 November 2026: npm 12.2.3 (18 November 2026, per the npm registry), pnpm v12.21.0 (13 November 2026, GitHub releases) and Yarn 4.18.1 (24 September 2026, yarnpkg/berry releases). Yarn also keeps a Classic 1.x line, latest 1.22.22.
Is pnpm really faster and smaller than npm?
That is pnpm's own claim on its motivation page, based on its content-addressable store and hard-link installs. Whether it holds for you depends on your repository, caches and CI - measure install time and disk use on your own project rather than trusting any published benchmark, including the vendors'.
What is the difference between Yarn Classic and Yarn Modern?
Two major lines share the name: Yarn Classic (1.x, latest 1.22.22) and Yarn Modern (4.x). Yarn's own migration page says Classic "remains a pillar of the JavaScript ecosystem" and recommends upgrading to Modern where possible; Modern supports three install strategies - PnP, node_modules and a pnpm-like content-addressed one.
What about Bun?
Bun is a separate JavaScript runtime and toolkit that also includes a package manager (its site describes runtime, package manager, test runner and bundler in one binary; v1.4.5 as of 21 November 2026). It overlaps with this comparison on installs but is a bigger bet, since it replaces the runtime too.
Do I need Corepack to use pnpm or Yarn?
No, but it is the standard way to pin versions per project. Per the Node.js documentation, Corepack was distributed with Node.js from 14.19.0 up to but not including 25.0.0; on Node 25 and later, install it yourself (npm install -g corepack) and run corepack enable. Check what your own Node distribution ships.
Can I switch an existing project to a different package manager?
Yes, but budget testing time. Expect a lockfile swap and CI command changes at minimum; pnpm's strict layout will surface undeclared dependencies as errors, pnpm 12 blocks unreviewed dependency build scripts by default until you allowlist them, and Yarn PnP has tooling-compatibility exceptions (Yarn's docs name React Native / Expo). Migrate one project, run the full test suite and CI, then decide.