[JavaScript / TypeScript Package Manager] pnpm: Fast, disk space efficient package manager
pnpm
Fast, disk space efficient package manager:
Features
-
Fast. Up to 2x faster than the alternatives (see benchmark).
-
Efficient. Files inside node_modules are linked from a single content-addressable storage.
-
Great for monorepos.
-
Strict. A package can access only dependencies that are specified in its package.json.
-
Deterministic. Has a lockfile called pnpm-lock.yaml.
-
Works as a Node.js version manager. See pnpm env use.
-
Works everywhere. Supports Windows, Linux, and macOS.
-
Battle-tested. Used in production by teams of all sizes since 2016.
Prerequisites
-
Node.js - https://nodejs.org/en/
Node.js® is a JavaScript runtime built on Chrome’s V8 JavaScript engine.
Install Node.js - https://nodejs.org/en/ CLI.
1
2Mac OS X
brew install nodeSee Node.js - https://nodejs.org/en/ to learn more about others OS.
Installation
Install pnpm
via npm
.
1 | npm install -g pnpm |
Once you have installed pnpm, there is no need to use other package managers to update it. You can upgrade pnpm using itself, like so:
1 | pnpm add -g pnpm |
Here is a list of handy npm equivalents to get you started:
npm command | pnpm equivalent |
---|---|
npm install | pnpm install |
npm i |
pnpm add |
npm run |
pnpm |
npm command pnpm equivalent
npm install pnpm install
npm i
npm run
See Commands | pnpm CLI | pnpm - https://pnpm.io/pnpm-cli to learn more.
References
[1] Fast, disk space efficient package manager | pnpm - https://pnpm.io/