[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

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
2
3
4
5
6
7
8
9
10
$ pnpm add -g pnpm
Nothing to stop. No server is running for the store at /Users/cloudolife/.pnpm-store/v3
Packages: +1
+
Packages are hard linked from the content-addressable store to the virtual store.
Content-addressable store is at: /Users/cloudolife/.pnpm-store/v3
Virtual store is at: node_modules/.pnpm
Progress: resolved 1, reused 0, downloaded 1, added 1, done

/Users/cloudolife/.asdf/installs/nodejs/16.13.1/.npm/pnpm-global/5:

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 pnpm add
npm run pnpm

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/

[2] pnpm/pnpm: Fast, disk space efficient package manager – 快速的,节省磁盘空间的包管理工具 - https://github.com/pnpm/pnpm

[3] npm - https://www.npmjs.com/