Master Code
On The Go

Learn. Practice. Build.

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

✅ pnpm is free and open source.

📦 Why pnpm?

1

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.

2

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 -
3

Verify Installation

pnpm --version

You should see something like 9.12.0.

4

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.

🎯 What's Next?

← All How-To Guides