pnpm ("performant npm") is a JavaScript package manager built by an open-source community as a faster, disk-space-efficient alternative to npm and Yarn. It's the #20 most-used developer tool, reported in roughly 13.4% of developer surveys. Instead of duplicating every package into every project's node_modules folder, pnpm stores one copy of each package version in a global content-addressable store and hard-links it into projects, saving huge amounts of disk space on machines with many JavaScript projects.
pnpm's commands mirror npm's closely, so switching over is nearly a drop-in swap.
# add a dependency
pnpm add react react-dom
# add a dev-only dependency
pnpm add -D typescript
# run a script from package.json
pnpm run build
Install pnpm globally via npm's corepack, then use it in place of npm install in any existing project.
# enable via corepack (bundled with Node.js 16.13+)
corepack enable pnpm
# or install directly
npm install -g pnpm
# install all dependencies for a project
pnpm install