Instead of npm: pnpm
Use pnpm. It installs from the same registry and reads the same package.json, but keeps one copy of each package version on disk and links it into projects, which makes installs several times faster than npm in pnpm's benchmarks. Its strict node_modules layout also stops code from importing packages it never declared.
Both are for installing and managing JavaScript dependencies from the npm registry.
Why pnpm is better
- pnpm's benchmark on a project with many small packages shows a clean install taking 46.0s with npm and 4.69s with pnpm 12, and a CI install from a lockfile taking 11.4s against 3.33s.
- Every package version is stored once in a content-addressable store and hard-linked into each project, so 100 projects using the same dependency do not keep 100 copies.
- Only your direct dependencies appear at the top of node_modules, so a missing entry in package.json fails immediately instead of working by accident through hoisting.
- It is the most used monorepo tool in the State of JS 2025 survey, ahead of npm workspaces, with workspace filtering and shared version catalogs built in.
- Supply-chain defaults are strict. Dependency build scripts do not run unless allowed, transitive dependencies cannot come from git or tarball URLs, and new versions are not installed until they are 1440 minutes old.
When to keep npm
Keep npm when you want zero extra tooling, since it ships with Node.js, or when a tool or platform in your pipeline only understands package-lock.json. npm has also closed part of the gap, since it now blocks dependency install scripts by default, as pnpm does.
Switching
Usually quick. Install pnpm, run pnpm import to turn package-lock.json into pnpm-lock.yaml, delete node_modules and run pnpm install. Then fix any import that worked only because npm hoisted an undeclared package, by adding it to package.json. For a monorepo, move the workspaces field into pnpm-workspace.yaml.
Watch out
Some older tools assume a flat node_modules and break on symlinks; setting nodeLinker to hoisted gives an npm-style layout as a fallback. The strict layout surfaces missing dependencies you will have to declare. The release-age delay means a fresh security patch is not installed for a day unless you lower minimumReleaseAge.
Also worth a look
- Bun A JavaScript runtime whose bun install also works as a fast package manager for Node projects; pick it if you already use Bun or want one binary for installing, running and testing.
More newer, better package managers and environment tools
Sources
- pnpm: Motivation
- pnpm: Benchmarks
- pnpm: Mitigating supply chain attacks
- npm docs: npm install
- Puppeteer documentation (note on install scripts)
- State of JavaScript 2025: Other tools
Judged on 2026-11-06. See every package managers and environment tools, or all 66 replacements.