pnpm (performant npm) is a fast, disk-efficient package manager for JavaScript that uses a content-addressable storage system with hard links to save disk space and speed up installations. Unlike npm and Yarn, which create flat or duplicated node_modules structures, pnpm creates a unique symlinked architecture from a single global store—meaning a package version is stored once on disk and reused across all projects. Since its creation in 2017, pnpm has evolved into the preferred choice for monorepos with native workspace support, catalogs for centralized version management, and stricter dependency resolution that prevents phantom dependencies. A key insight: pnpm's content-addressable store can save 50-70% disk space and install packages 2-3x faster than npm, making it especially valuable in CI/CD pipelines and development environments managing multiple projects.
What This Cheat Sheet Covers
This topic spans 17 focused tables and 89 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: Installation Commands
| Command | Example | Description |
|---|---|---|
pnpm installpnpm i | Installs all dependencies from package.json; automatically uses frozen-lockfile mode in CI environments to ensure reproducible builds | |
pnpm add reactpnpm add -D typescript | Adds a package to dependencies; use -D for devDependencies, -O for optionalDependencies, -E for exact version (no ^ or ~) | |
pnpm add -g typescript | Installs package globally to PNPM_HOME directory; binaries become available system-wide in your shell path | |
pnpm remove lodashpnpm rm lodash | Removes a package from dependencies and uninstalls from node_modules; also updates lockfile to reflect the change |