This article is published in English.
Why pnpm Installs Faster Than npm: Store, Links, and Strict node_modules
pnpm beats npm on install speed by using a content-addressable store, hard links instead of copies, and a strict symlinked node_modules that skips expensive hoisting.
After moving a repository from npm to pnpm, install duration often falls sharply. That gap is not imagination. pnpm was designed around the performance and storage pain of classic npm installs, and the two tools store packages so differently that the speed delta is an architectural change, not a small tweak.
The sections below walk through the reasons pnpm tends to win, especially as apps and monorepos get larger.
1. A Content-Addressable Store Instead of Duplicated Files
The dominant win comes from how packages land on disk. With npm, each project receives its own physical tree of every dependency under node_modules. Ten apps that all need lodash therefore keep ten separate on-disk copies of that release.
pnpm maintains one global content-addressable store for the machine. Each version occupies a single slot there; a project that needs it receives hard links (or copy-on-write references) from that store into its local node_modules. Consequences include:
- Skipped re-downloads when the store already holds the version
- Skipped re-writes of bytes that already exist on disk
- Far less space consumed when many projects share libraries
Because install work is dominated by disk I/O, eliminating repeated writes is where most of the latency disappears.
2. Hard Links and Symlinks Instead of Copying
npm’s install path copies package files into node_modules. Copying thousands of files in a deep tree is costly.
pnpm prefers hard links from the global store into the project, plus symlinks that shape the nested layout to match the dependency graph. A link is effectively free compared with a copy: the OS records another pointer to the same blocks instead of duplicating them.
3. Efficient Caching Across Projects
npm also caches downloads, yet it still expands and copies from that cache into every project. Under pnpm’s store model, once a version exists anywhere on the machine, bringing it into a brand-new project is nearly immediate—no second download and little extra processing.
That behavior stands out when:
- Jumping between branches that pin different dependency sets
- Maintaining several repositories that share common libraries
- Running CI jobs that restore a shared store across builds
4. A Non-Flat node_modules Structure That Avoids Extra Resolution Work
Older npm hoisting flattened node_modules to cut duplication, but that strategy adds its own cost: heavyweight resolution to decide where each package should sit without conflicts.
pnpm keeps a strict, symlinked node_modules layout so a package only sees the dependencies it declared (no accidental phantom imports). Safer resolution is not the only payoff—it also skips npm’s expensive hoist planning, trimming CPU during installs.
5. Parallelized Operations
pnpm schedules resolve, fetch, and link steps concurrently whenever it can, more aggressively than npm’s typical path. Pair that concurrency with link-instead-of-copy I/O and total wall time drops further, especially on trees with huge dependency graphs.
6. Real-World Impact Grows with Project Size
On a toy app with a handful of packages the difference may look modest. The advantage scales with:
- Monorepos whose many packages reuse the same libraries
- Teams juggling several products on shared dependencies
- CI/CD pipelines that install repeatedly per build
- Large dependency trees typical of modern frontend stacks
In those settings, store-and-link installs that once took minutes under npm can shrink toward seconds.
7. Disk Space Savings Are a Side Effect, Not Just a Bonus
Speed is the headline, yet the same design solves storage too. Because packages are not cloned per project, groups often reclaim gigabytes. On slower disks, less data to churn also nudges throughput upward as a secondary effect.
A Quick Analogy
Picture npm as a library that photocopies the same title for every borrower. pnpm is a library where everyone shares one shelf and each reader receives a bookmark to the shared copy. Photocopying costs time and paper; pointing at an existing volume is nearly free.
Conclusion
pnpm’s edge over npm is not a cosmetic flag. It rethinks storage and linking: avoid duplicate downloads, prefer links over copies, and skip unnecessary hoist work. Installs—often the slowest stretch of frontend workflows—become a quicker, leaner step.
For teams with several projects or a monorepo, adopting pnpm is among the simplest improvements available for both install latency and disk use.