Features
- Content-addressable storage saves disk space
- Strict dependency isolation prevents phantom deps
- First-class monorepo workspace support
- Up to 2x faster installs than npm
Pros
- Saves significant disk space via hard links
- Strict mode catches dependency issues early
- Excellent monorepo support with workspace filtering
Cons
- Strict node_modules structure can break some packages
- Requires separate installation (not bundled with Node)
- Some packages need shamefully-hoist or public-hoist-pattern
Overview
pnpm is a fast, disk-space-efficient package manager for JavaScript. Its key innovation is a content-addressable file store: packages are saved in a single location on disk and hard-linked into each project’s node_modules, dramatically reducing disk usage when you have multiple projects.
Unlike npm’s flat node_modules structure, pnpm creates a properly nested structure that strictly enforces declared dependencies. This means your code can only access packages you have explicitly declared in package.json, preventing the “phantom dependency” problem where code accidentally relies on undeclared transitive dependencies.
pnpm has become the preferred package manager for many open-source projects and companies that manage monorepos, thanks to its workspace features, filtering capabilities, and overall performance.
When to Use
Choose pnpm for monorepos and multi-project setups where disk space and dependency correctness matter. It is the best general-purpose package manager for teams that want strict dependency management.
Getting Started
npm install -g pnpm
pnpm init
pnpm add react react-dom
pnpm dev