At this point, the comparison can be made on useful terms.
At a high level, npm and pnpm do the same job.
Both can:
- read
package.json - install dependencies
- write a lockfile
- run project scripts
- support workspaces
The important question is not which tool is more legitimate. The important question is which workflow fits the repository.
The biggest similarity
The underlying concepts are the same:
- packages
- dependencies
- scripts
- lockfiles
- local project installs
That is why moving from one tool to the other is usually easier than it first appears.
The biggest differences
npm is the default starting point
Because npm ships with Node.js, it is the package manager many people learn first.
That usually means:
- more tutorials use it
- more beginners see it first
- many projects keep using it without needing anything else
pnpm is often chosen intentionally
Teams often adopt pnpm because they want its workflow characteristics rather than because they happened to receive it by default.
Common reasons include:
- fast repeated installs
- efficient use of disk space
- a strong fit for workspaces and monorepos
- a command set many developers find more explicit
Some command pairs are different enough to matter
| Task | npm | pnpm |
| --- | --- | --- |
| Install project dependencies | npm install | pnpm install |
| Add a package | npm install react | pnpm add react |
| Add multiple packages | npm install react react-dom | pnpm add react react-dom |
| Add a dev dependency | npm install -D typescript | pnpm add -D typescript |
| Remove a package | npm uninstall react | pnpm remove react |
| Run a script | npm run dev | pnpm dev |
| Run a local binary directly | npm exec -- eslint . | pnpm exec eslint . |
| Run a one-off package | npx create-vite@latest my-app | pnpm dlx create-vite@latest my-app |
The concepts are shared, but the command habits are not identical.
The biggest mindset difference is often this:
- in npm,
installcommonly means both “install what the project already has” and “add a new package” - in pnpm,
installandaddare separated more explicitly
Use the reference pages for command recall
If you need a quick command lookup, use the dedicated reference pages:
Those pages are better for recall. This page is better for understanding the tradeoffs.
What does not change
Whichever package manager a repository uses:
- commit the lockfile
- use one package manager per repository
- review dependency changes carefully