How-To Guide
How to Install pnpm
pnpm is a fast, disk-efficient package manager that works with every npm project. Here's how to install it in under 5 minutes.
📋 What You'll Need
- Node.js 18+ installed — see our Install Node.js guide
- A terminal
- 5 minutes of your time
✅ pnpm is free and open source.
📦 Why pnpm?
- Faster installs than npm — often 2–3× on cold installs
- Uses less disk — hard links packages instead of copying them
- Stricter dependencies — prevents phantom dependencies
- Drop-in replacement —
pnpm installworks with any npm project
Enable Corepack (Recommended)
Node.js ships with Corepack — a tool that manages package managers. Enable it:
corepack enable
On Linux and macOS you may need sudo corepack enable.
Install pnpm
With Corepack enabled:
corepack prepare pnpm@latest --activate
Or install globally with npm:
npm install -g pnpm
Or with the official standalone script (macOS/Linux):
curl -fsSL https://get.pnpm.io/install.sh | sh -
Verify Installation
pnpm --version
You should see something like 9.12.0.
Use It in a Project
Go to any Node.js project and try:
pnpm install # instead of npm install
pnpm add react # instead of npm install react
pnpm add -D typescript # dev dependency
pnpm remove lodash # remove a package
pnpm run dev # run a script
💡 pnpm and npm can coexist. You don't have to switch every project — just use pnpm where you want the speed.
🔧 Troubleshooting
"pnpm: command not found"
Restart your terminal. If using Corepack, check that corepack enable succeeded without errors.
"Cannot find matching keyid"
Update Node.js to version 20+ or install pnpm via the standalone script instead of Corepack.