pnpm(1)
Fast, disk space efficient package manager for JavaScript and Node.js projects that uses a content-addressable filesystem to store dependencies.
Synopsis
pnpm [COMMAND] [OPTIONS] [ARGS]Description
pnpm is a package manager for Node.js that improves upon npm and yarn by using hard links and content-addressable storage to avoid duplication. It creates a non-flat node_modules structure and is significantly faster and more space-efficient than traditional package managers.
pnpm supports monorepos through workspaces, offers strict dependency resolution, and maintains compatibility with the npm registry. It uses a pnpm-lock.yaml file for deterministic installations across environments.
Common options
| Flag | What it does |
|---|---|
-v, --version | Display the installed pnpm version |
-h, --help | Show help information for a command |
--global, -g | Operate on the global store instead of the current project |
--save, -S | Save packages to dependencies in package.json |
--save-dev, -D | Save packages to devDependencies in package.json |
--save-peer, -P | Save packages to peerDependencies in package.json |
--no-save | Install packages without modifying package.json |
--workspace-root | Run the command from the workspace root |
-r, --recursive | Run the command on every project in the workspace |
--filter <pattern> | Run command only on packages matching the pattern |
Examples
Install all dependencies listed in package.json and pnpm-lock.yaml
pnpm installAdd express to dependencies and install it
pnpm add expressAdd eslint as a dev dependency
pnpm add -D eslintRemove lodash package and update package.json
pnpm remove lodashRun the 'start' script defined in package.json
pnpm startInstall dependencies for all packages in a monorepo workspace
pnpm -r installAdd typescript only to the @myapp/ui workspace package
pnpm --filter @myapp/ui add typescriptClean up unreferenced packages from the pnpm store
pnpm store prune