In the pnpm vs npm vs Yarn vs Bun decision for 2026, pnpm is the best default for most teams and monorepos: it is fast, disk-efficient, strict about undeclared dependencies, and ships the strongest supply-chain defaults. npm is the zero-setup choice that now blocks dependency install scripts by default in npm 12. Yarn 4 makes sense if you want Plug'n'Play or already run Berry. Bun is the fastest all-in-one option when Bun is also your runtime.

The bigger story this year is that all four converged on safer defaults. Every one of them now refuses to run dependency postinstall scripts unless they are approved (Bun pre-approves a curated list of popular packages), and pnpm and Yarn also delay freshly published versions by default. This comparison covers current versions, node_modules layouts, workspaces and catalogs, lockfiles, security settings with the exact config keys, Corepack's status, CI caching, and published benchmarks. Versions were checked against the npm registry and each project's release notes on 2026-11-26.

Current Versions (November 2026)

Tool Latest stable Major released Requires Notes
npm 12.2.3 12.0.0 on 2026-07-08 Node ^22.22.2, ^24.15.0 or >=26.0.0 npm 11 still maintained (11.21.3)
pnpm 12.23.0 12.0 on 2026-08-26 pnpm 11 needs Node 22+ pnpm 12 is a Rust rewrite; 11.29.0 still maintained
Yarn (Berry) 4.19.0 4.0.0 on 2023-10-22 Node Published as @yarnpkg/cli-dist; the yarn npm package is still Classic 1.22.22
Bun 1.4.5 1.3 on 2025-10-10, 1.4 on 2026-08-20 None (own runtime) Package manager ships inside the Bun binary

A few things changed that older comparisons miss. pnpm 11 (April 2026) flipped several security defaults, replaced the JSON-per-package store index with a single SQLite database, and moved all non-auth settings out of .npmrc into pnpm-workspace.yaml. pnpm 12 then rewrote pnpm in Rust while keeping the CLI and lockfile compatible. npm 12 made dependency lifecycle scripts opt-in, removed npm shrinkwrap and npm adduser, and defaulted git and remote-tarball dependencies to "none". Yarn shipped its security changes inside the 4.x line rather than as a new major.

How Each One Lays Out node_modules

This is the most important technical difference because it decides which bugs you hit.

Tool Default layout Alternatives
npm Hoisted, flat node_modules install-strategy=linked (isolated node_modules/.store, stable since npm 12), nested, shallow
pnpm Isolated: content-addressable store, hard links into node_modules/.pnpm, symlinks for direct deps nodeLinker: hoisted
Yarn 4 Plug'n'Play (.pnp.cjs loader, no node_modules) nodeLinker: pnpm (symlinks + hard links to a global store) or node-modules
Bun Isolated for new workspaces, hoisted for new single-package projects install.linker in bunfig.toml

Hoisted layouts (npm's default) put almost everything at the top level. Your code can import a package you never declared, because a dependency happened to pull it in. That works until the transitive dependency changes, then breaks in production. npm's own docs now recommend --install-strategy=linked during development to catch these "phantom" dependencies.

Isolated layouts (pnpm's default) only expose what a package declares. Files come from a global content-addressable store via hard links, so ten projects using the same version of React store it once on disk. pnpm 12 tries a hard link before a reflink on Linux; on macOS it keeps clone-first because APFS clonefile is fast.

Plug'n'Play (Yarn's default) skips node_modules entirely and resolves imports through a generated loader. It is strict and fast but still requires tooling that understands PnP. Most teams that adopt Yarn 4 today set nodeLinker: node-modules or pnpm and keep Yarn for its other features.

Bun made isolated installs the default for new workspaces in Bun 1.3 while keeping hoisted for single-package projects; projects created before v1.3.2 stay hoisted, controlled by the lockfile's configVersion.

Workspaces, Catalogs and Lockfiles

All four support workspaces. The differences are in where configuration lives and whether you get catalogs, the feature that lets a monorepo define a dependency version once and reference it as "react": "catalog:" from every package.

Tool Workspace config Catalogs Lockfile
npm workspaces in root package.json Not supported as of npm 12.2 package-lock.json
pnpm packages in pnpm-workspace.yaml Yes, in pnpm-workspace.yaml pnpm-lock.yaml
Yarn 4 workspaces in package.json Yes since 4.10.0, in .yarnrc.yml yarn.lock
Bun workspaces in package.json Yes since 1.3, in package.json bun.lock (text since 1.2)

A pnpm catalog looks like this:

# pnpm-workspace.yaml
packages:
  - "apps/*"
  - "packages/*"
catalog:
  react: ^19.3.0
  typescript: ^7.0.0
{
  "name": "@acme/web",
  "dependencies": {
    "react": "catalog:"
  }
}

Bun reads the same catalog: protocol and its migration keeps those references, which makes moving between pnpm and Bun easier than it used to be. If your monorepo also needs task orchestration and caching on top of the package manager, see our Nx vs Turborepo comparison.

Two lockfile notes. pnpm 12 made lockfiles of cyclic dependency graphs deterministic, so expect a one-time diff the first time it re-resolves. And npm-shrinkwrap.json is no longer honoured by npm 12: rename it to package-lock.json.

Security Defaults in 2026: Install Scripts and Release-Age Delays

Most npm supply-chain attacks of the last few years ran through postinstall scripts, and most malicious versions were detected within hours or days. That is why every tool now ships two controls: an allowlist for install scripts, and a minimum age before a new version can be installed.

Control npm 12 pnpm 11/12 Yarn 4.19 Bun 1.4
Dependency install scripts Blocked unless in allowScripts (since 12.0) Blocked unless in allowBuilds; strictDepBuilds: true fails the install Blocked: enableScripts: false default (since 4.14.0) Blocked unless in trustedDependencies or Bun's curated default list
Approve command npm install-scripts approve <pkg> pnpm approve-builds <pkg> dependenciesMeta in package.json bun pm trust <pkg>
Release-age delay min-release-age in days (since 11.10.0), off by default minimumReleaseAge in minutes, default 1440 (since 11.0) npmMinimalAgeGate, default 1d (since 4.15.0) minimumReleaseAge in seconds under [install] in bunfig.toml
Git/exotic deps allow-git and allow-remote default none blockExoticSubdeps: true approvedGitRepositories (since 4.14.0) Not a default

npm 12

The npm 12.0.0 changelog says it plainly: "Dependency lifecycle scripts are now blocked by default unless allowed by the root package's allowScripts policy." We confirmed this by installing esbuild@0.25.0 with npm 12.2.3 in a scratch project:

npm warn install-scripts 1 package had install scripts blocked because they are not covered by allowScripts:
npm warn install-scripts   esbuild@0.25.0 (postinstall: node install.js)

Running npm install-scripts approve esbuild wrote a version-pinned entry into package.json:

{
  "allowScripts": { "esbuild@0.25.0": true }
}

Pinning is the default, so a compromised future version of an approved package does not inherit the approval. Set strict-allow-scripts=true to turn the warning into a hard failure in CI, and add a release-age delay in .npmrc:

min-release-age=3
strict-allow-scripts=true

pnpm 11 and 12

pnpm has blocked dependency lifecycle scripts since 10.0.0 (January 2025). pnpm 11 replaced the old onlyBuiltDependencies/neverBuiltDependencies lists with a single allowBuilds map and made strictDepBuilds the default, so an unapproved build script now fails the install. With pnpm 12.8.1 the same esbuild install stopped with ERR_PNPM_IGNORED_BUILDS, and pnpm approve-builds esbuild produced:

# pnpm-workspace.yaml
allowBuilds:
  esbuild: true
minimumReleaseAge: 1440        # default since pnpm 11; 0 opts out
minimumReleaseAgeExclude:
  - "@acme/*"                  # your own packages, released and consumed immediately
trustPolicy: no-downgrade

minimumReleaseAge arrived in 10.16.0 and became a one-day default in 11.0. trustPolicy: no-downgrade refuses a version whose publishing trust level dropped, for example a package that was published via trusted publishing and suddenly is not; our guide to npm trusted publishing explains what those trust levels mean. pnpm 12 also reports unknown keys in pnpm-workspace.yaml, which matters because a misspelled minimumReleaseAge used to disable the policy silently.

Yarn 4

Yarn made enableScripts: false the default in 4.14.0 and npmMinimalAgeGate: 1d the default in 4.15.0, per the Yarn release notes. Re-enable scripts for specific packages with dependenciesMeta:

{
  "dependenciesMeta": {
    "esbuild": { "built": true }
  }
}

Yarn's enableHardenedMode also validates lockfile entries against the registry and turns itself on automatically for pull requests on public GitHub repositories.

Bun

Bun has never run arbitrary dependency lifecycle scripts. Per the Bun lifecycle docs, a curated list of popular packages is allowed by default; setting trustedDependencies in package.json replaces that list rather than extending it, and an empty array opts out entirely. bun pm untrusted lists blocked scripts and bun pm trust <pkg> approves one. The release-age delay is in seconds:

# bunfig.toml
[install]
minimumReleaseAge = 259200  # 3 days

Corepack in 2026

Corepack, the shim that reads the packageManager field and runs the pinned pnpm or Yarn version, is no longer part of Node.js. The Corepack README states it was "distributed with Node.js from version 14.19.0 up to (but not including) 25.0.0." On Node 25 and later, install it yourself with npm install -g corepack (0.36.0 is current) or pin the manager another way. Our Node.js 26 LTS upgrade guide covers that change alongside the rest of the upgrade.

pnpm 12 now fills part of that gap: it can install npm, Yarn and Bun itself, verifies npm-published ones against registry signatures, and pnpm add yarn@4 writes "packageManager": "yarn@..." for Corepack users. In CI, the simplest approach is still to pin the version explicitly, for example with pnpm/action-setup or npm install -g pnpm@12.23.0, so builds do not depend on what the runner image ships.

CI Caching and Reproducible Installs

Each tool has a "use the lockfile exactly or fail" mode. Use it in every CI job:

Tool Frozen install What to cache
npm npm ci ~/.npm (keyed on package-lock.json)
pnpm pnpm install --frozen-lockfile Output of pnpm store path
Yarn 4 yarn install --immutable Yarn global cache (under yarn config get globalFolder)
Bun bun install --frozen-lockfile ~/.bun/install/cache

A minimal GitHub Actions setup for pnpm:

- uses: pnpm/action-setup@v6
  with:
    version: 12.23.0
- uses: actions/setup-node@v7
  with:
    node-version: 24
    cache: pnpm
- run: pnpm install --frozen-lockfile

Cache the package manager's download cache, not node_modules. Restoring node_modules across lockfile changes produces subtle mismatches, while a warm store or cache keeps installs fast and correct. With pnpm 11's default minimumReleaseAge, a fresh lockfile entry younger than a day will fail resolution in CI; that is the policy working, so add internal scopes to minimumReleaseAgeExclude rather than turning it off.

Performance: What the Benchmarks Actually Show

We are only citing the official pnpm benchmark page, with its caveats. Its current data (fetched 2026-11-22) compares npm 12.2.3, pnpm 11.28.13 and pnpm 12.23.0. Each figure is the fastest of the three most recent runs, installs use the same registry over an emulated 50 ms / 200 Mbps link, and the hardware is not stated. Yarn and Bun are not included, so we do not quote numbers for them.

Scenario ("alotta-packages" fixture) npm 12.2.3 pnpm 11.28.13 pnpm 12.23.0
Clean install 1m 36s 20.4s 13.1s
With lockfile 27.3s 11.1s 8.59s
Warm cache + lockfile 12.6s 3.17s 1.17s
Everything warm 1.45s 394ms 20ms

The page is published by the pnpm project, so read it as a vendor benchmark. Bun publishes its own install claims; run your own lockfile on your own CI hardware before switching for speed alone. For most teams the difference between "fast" and "faster" matters less than strictness and security defaults. If you are evaluating Bun as a runtime too, our Deno 2 vs Bun comparison covers the runtime side.

Decision Table: pnpm vs npm vs Yarn vs Bun

If you... Choose Why
Run a JavaScript or TypeScript monorepo pnpm Isolated layout, catalogs, strict build approval, fastest in its published benchmark
Want zero extra tooling npm 12 Ships with Node, now blocks install scripts by default; enable install-strategy=linked to catch phantom deps
Already run Yarn Berry, or want PnP Yarn 4 Mature workspaces and constraints; security defaults now match pnpm
Use Bun as your runtime and test runner Bun One binary, fast installs, catalogs and isolated workspaces since 1.3
Publish packages consumed by all four Test with npm and pnpm npm's hoisting hides undeclared deps that pnpm users will hit
Need to stay on Node 20 npm 11 or pnpm 10 npm 12 and pnpm 11+ dropped older Node lines

When migrating, switch one repository at a time, commit the new lockfile in its own pull request, and diff the resolved versions. For package.json edits, a JSON formatter catches the trailing comma that would otherwise break every install.

Frequently Asked Questions

Is pnpm faster than npm in 2026?

In pnpm's official benchmark, pnpm 12.23.0 completed a clean install of its large fixture in 13.1s versus 1m 36s for npm 12.2.3, and was faster in every scenario measured. That benchmark is run by the pnpm project with unstated hardware, so confirm with your own lockfile.

Does npm block postinstall scripts now?

Yes, from npm 12.0.0. Dependency lifecycle scripts are skipped unless the root package.json lists the package in allowScripts. Approve packages with npm install-scripts approve <pkg> and run npm rebuild to execute newly approved scripts.

Is Corepack still included with Node.js?

No. Corepack was bundled from Node.js 14.19.0 up to but not including 25.0.0. On Node 25 and later, install it with npm install -g corepack or pin the package manager version in CI directly.

Should I use Yarn Plug'n'Play in 2026?

Only if your tooling supports it. PnP is still Yarn's default nodeLinker, but many teams set nodeLinker: node-modules or pnpm for compatibility. Yarn's newer security defaults apply regardless of the linker.

Can Bun replace npm for a Node.js project?

Bun can install dependencies for a Node.js project and writes a bun.lock file; you can keep running the app on Node. Check that every team member and CI job uses Bun for installs, because mixing lockfiles from different managers in one repository causes drift.

Bottom Line

For pnpm vs npm vs Yarn vs Bun in 2026, the safe pick for most teams is pnpm: isolated installs, catalogs, the strongest default supply-chain protection and the best published install times. npm 12 closed much of the security gap and is the right answer when you want nothing extra to install. Yarn 4 suits teams already invested in Berry. Bun is compelling when it is also your runtime. Whichever you choose, keep install scripts on an allowlist, set a release-age delay, and run frozen installs in CI.