pnpm
pnpm 9+Quick reference for pnpm: install / add / remove / update, scripts, workspaces, store & cache and config — focused on the GitHub-site pnpm repo workflow, with options and practical examples.
31 commands
Install & Manage
pnpm installInstall all dependencies declared in package.json, updating the lockfile as needed.
--frozen-lockfile (CI default in this repo); --prod; --offline; --ignore-scripts; --shamefully-hoist; --strict-peer-dependencies=false; --prefer-offline
pnpm install --frozen-lockfilepnpm add <pkg>Add a runtime dependency and write to package.json.
-D / --save-dev; -E / --save-exact; -O / --save-optional; -P / --save-prod; -g global; --workspace-root add at workspace root
pnpm add -D vitest @types/nodepnpm add -g <pkg>Install a global tool (e.g. TypeScript, ESLint, tsx) onto the path.
-g; --global-prefix; --reporter append|ndjson
pnpm add -g typescript tsxpnpm remove <pkg>Remove a dependency from the project and the lockfile.
-D from devDependencies; -g from globals; --filter pkg remove from one workspace only
pnpm remove lodash && pnpm remove -F web -D @types/jestpnpm update / pnpm update -LUpdate dependencies within the semver range; -L / --latest upgrades to the newest version.
-L / --latest; -i / --interactive; --workspace-root; --filter
pnpm update -i vue && pnpm update -L @nuxt/i18npnpm outdatedShow outdated packages alongside current / wanted / latest versions.
--long; --recursive / -r; --filter
pnpm outdated -r --longpnpm listList installed packages and a tree of what depends on them.
--depth 0 only direct; --prod / --dev; -r recursive; --json | jq
pnpm list --depth 0 --prod | head -20pnpm audit / pnpm audit --fixRun the npm-style security advisory check against the lockfile.
--prod only production; --json
pnpm audit --json | jq '.metadata.vulnerabilities'pnpm dedupePrune the lockfile/dependency tree by hoisting to a single version where possible.
--check; --strict-peer-dependencies=false
pnpm dedupe --checkpnpm rebuildRebuild native dependencies (post-build / after Node version bump).
--reporter; --recursive; --filter
pnpm rebuild -r && pnpm rebuild esbuildpnpm approve-buildsApprove build scripts for native packages (e.g. esbuild, sharp, @swc/core).
interactive prompts; can also be set via package.json#pnpm.onlyBuiltDependencies
pnpm approve-builds --yes esbuild @parcel/watcherpnpm importImport an existing package-lock.json / yarn.lock into a pnpm-lock.yaml.
import; n/a other params
pnpm import --no-lockfileRun & DX
pnpm run <script>Run a script defined in package.json#scripts.
-r / --recursive run in every package; --filter / -F target one; --parallel; --no-color
pnpm run dev && pnpm -F src/www run buildpnpm dlx <pkg>Fetch a package from the registry and run its binary without permanently installing.
dlx pkg args; --package extra pkg; --silent
pnpm dlx create-vite@latest my-app --template vue-ts && pnpm dlx vitest --runpnpm exec <cmd>Run a command in the project's context (PATH includes .node_modules/.bin).
exec ...; --filter target workspace; --recursive; --parallel
pnpm exec vitest run && pnpm exec -- tsc --noEmit -p src/www/tsconfig.jsonpnpm create <name>Scaffold a new project from a create-* style package.
create [name] [args]; -y / --yes
pnpm create nuxt my-app && cd my-app && pnpm installWorkspace
pnpm -r <cmd>Recursive — run a pnpm action across every package in the workspace.
-r run build; --parallel; --topology sort; --order
pnpm -r --filter "./packages/**" run build --silentpnpm --filter <pkg>Target one package by name, directory, glob or ./relative-path.
--filter pkg | --filter ./packages/foo | --filter {pkg} strict name only; -F alias
pnpm --filter trowsoft-pdf-merge run build && pnpm -F "./packages/tools/*" outdatedpnpm add ... -w / --workspace-rootAdd a hoisted dev dependency that's shared across the workspace.
-w / --workspace-root; -D to devDeps
pnpm add -Dw typescriptStore & Cache
pnpm store pathPrint the location of pnpm's content-addressable store (deduped across projects).
store path; --virtual-store-dir DIR
pnpm store path && du -sh $(pnpm store path)pnpm store pruneRemove unreferenced packages from the store (reduces disk usage).
store prune; --force skip prompt
pnpm store prunepnpm cache list / cache deleteList or delete entries in pnpm's metadata cache.
cache list; cache delete <pkg>@<ver>; --registry
pnpm cache list vitest@latestConfig & Info
pnpm config get|set <key> [value]Read or write to the user's/global/store/project pnpm config.
config get key; config set key val; --location project|user|global
pnpm config set registry https://registry.npmjs.org/ --location user && pnpm config get registrypnpm config delete|listList all effective config keys, or delete one.
config list --location project; config delete key
pnpm config list --location projectpnpm why <pkg>Explain why a package is in node_modules — show the chain of dependants.
--prod; --dev; -r; --filter
pnpm why -r vue && pnpm why lodash -rpnpm link / pnpm link --globalSymlink a local package into the current project, or install a global package locally.
link (uses ./); link --global <pkg>; --dir
cd packages/tools/foo && pnpm link --global && cd my-app && pnpm link --global fooPublish & Pack
pnpm publishPublish the current package to the configured registry.
--dry-run; --tag alpha|beta|next; --access public|restricted; --otp N; --filter
pnpm publish --dry-run --tag canary --access publicpnpm packCreate a tarball of the package without publishing (for upload elsewhere).
--pack-gzip-level 0..9; --pack-destination DIR
pnpm pack --pack-destination ./releaseRecurring Workflows
pnpm recursive list / pnpm -r whyInspect the dependency tree across all workspaces at once.
pnpm recursive list --depth 0pnpm run --filter <pkg> testRun a script in just one workspace — perfect for fine-grained CI.
--filter with dependencies/dependents; --parallel
pnpm --filter "trowsoft-pdf-*" run build --parallelpnpm sync:tools / pnpm build:toolsRepo helpers from this site — sync tool translations into the Nuxt app, then build tool bundles.
pnpm sync:tools && pnpm build:toolsRelated command cheatsheets
volta
Quick reference for everyday Volta commands: install Node / npm / Yarn / pnpm toolchains, pin per-project versions, manage global packages, and troubleshoot Volta itself — with common options and practical examples.
25 commands
Volta 1.x
npm
Quick reference for everyday npm CLI commands: init / install / add / remove / update / scripts / run / publish / audit, plus lockfile, registry, and cache management — with common options and practical examples.
34 commands
npm 10+
yarn
Quick reference for everyday Yarn CLI commands (both Yarn Classic 1.x and Yarn Berry 2/3/4): install / add / remove / run / workspaces, lockfile, Plug'n'Play, and Berry configuration — with common options and practical examples.
33 commands
Yarn 1.x (classic) / Yarn 4 (berry)
npx
Quick reference for npx commands: run one-off package binaries, scaffold projects, manage the npx cache, pin versions, and avoid pitfalls with interactive CLIs — with common options and practical examples.
25 commands
npx 10+ (shipped with npm)
vite
Quick reference for Vite CLI commands: dev server, build, preview, dependency pre-bundling, plugin management, environment variables, and project inspection — with common options and practical examples.
30 commands
Vite 5+
Trademark & Use Notice
These command-line tool cheatsheets are open community references. The names, logos, and trademarks of the tools referenced here (such as Git™, Docker™, Kubernetes®, kubectl, PostgreSQL®, MySQL®, Redis™, MongoDB®, Linux™, PowerShell™, Vim™, and others) are the property of their respective owners and are used here solely for identification and reference purposes.
All content in these cheatsheets is independently authored as a simplified, self-contained reference. It is not affiliated with, endorsed by, or sourced from any official documentation. Command listings, flag descriptions, and examples are original simplifications; for authoritative information please consult the official documentation of each tool.
Command syntax and option flags may differ across tool versions. The version tags shown reflect stable releases; behavior may differ in other versions. This cheatsheet does not imply any preference or recommendation by the trademark holders.
If a trademark or copyright owner believes that any content on this site infringes their rights, please send an email to [email protected]. Upon receiving valid proof of rights, we will modify or remove the relevant content within a reasonable period.
This website assumes no legal liability for any direct or indirect losses arising from the use of information presented on these pages.
About pnpm
pnpm is an open-source Node.js package manager created by Zoltan Kochan in 2017 as a faster, disk-efficient alternative to npm and Yarn; the current stable line is pnpm 9+ and it remains a drop-in replacement for the npm CLI, reading the same `package.json` and `node_modules` contracts. Its key innovation is a content-addressable store under `~/.local/share/pnpm/store` (or `pnpm-store/` for per-project): every package version is downloaded once and shared across projects via hard links, which keeps disk usage small and installs fast. pnpm enforces a non-flat `node_modules` layout by default, so packages can only import what they declare in their own `package.json` (no phantom dependencies), which surfaces real bugs at install time rather than at runtime. Features include workspaces (monorepo), `pnpm dlx` (like `npx`), the `pnpm filter` selector, lifecycle scripts with deterministic ordering, a strict-peer-dependencies mode, and patched dependencies via `pnpm patch`. Use pnpm in any Node project for the speed and correctness win; reach for npm when you must reproduce a CI run pinned to npm itself. pnpm never sends package contents anywhere — the registry traffic is just tarball downloads over HTTPS.
Cheatsheet version 1.0.0