PNPM commands

Fast, disk space efficient package manager for Node.js

205 commands

Init & Config

  • pnpm init

    Create a package.json file with all defaults in the current directory

  • pnpm config set registry https://registry.npmjs.org/

    Set the default npm registry URL for pnpm

  • pnpm config get registry

    Get the currently configured registry URL

  • pnpm config delete registry

    Remove the registry config key, reverting to default

  • pnpm config list

    List all active pnpm configuration values

  • pnpm config list --json

    List all pnpm config values in JSON format

  • pnpm config set save-exact true

    Configure pnpm to save exact versions instead of semver ranges

  • pnpm config set store-dir /path/to/store

    Set a custom directory for the pnpm content-addressable store

  • pnpm config set global-dir /path/to/global

    Set the directory for globally installed packages

  • pnpm config set global-bin-dir /usr/local/bin

    Set the directory where global package binaries are linked

  • pnpm config set shamefully-hoist true

    Hoist all dependencies to node_modules root for maximum compatibility

  • pnpm config set hoist-pattern *

    Set a glob pattern for which packages to hoist to the root node_modules

  • pnpm config set public-hoist-pattern *eslint*

    Set a pattern for packages to hoist to the root for tooling access

  • pnpm config set node-linker hoisted

    Set the node linker strategy to hoisted for compatibility with npm layout

  • pnpm config set node-linker isolated

    Set the node linker strategy to isolated for strict dependency isolation

  • pnpm config set auto-install-peers true

    Automatically install missing peer dependencies

  • pnpm config set strict-peer-dependencies false

    Disable errors on missing or incompatible peer dependencies

  • pnpm config set prefer-frozen-lockfile true

    Always use the lockfile as-is without attempting updates

  • pnpm config set proxy http://proxy.example.com:8080

    Set an HTTP proxy for pnpm network requests

  • pnpm config set https-proxy http://proxy.example.com:8080

    Set an HTTPS proxy for pnpm network requests

Install & Add Packages

  • pnpm install

    Install all dependencies listed in package.json using the lockfile

  • pnpm install --prod

    Install only production dependencies, skipping devDependencies

  • pnpm install --dev

    Install only devDependencies

  • pnpm install --frozen-lockfile

    Install dependencies without updating the lockfile, failing if out of sync

  • pnpm install --no-frozen-lockfile

    Install dependencies and allow updating the lockfile if needed

  • pnpm install --force

    Force reinstall all packages, bypassing the store cache

  • pnpm install --ignore-scripts

    Install packages without running any lifecycle scripts

  • pnpm install --prefer-offline

    Use cached packages when available, falling back to network

  • pnpm install --offline

    Install using only the local store, failing if any package is missing

  • pnpm install --shamefully-hoist

    Hoist all packages to root node_modules for this install

  • pnpm install --resolution-only

    Update the lockfile without installing anything into node_modules

  • pnpm install --lockfile-only

    Update pnpm-lock.yaml only without touching node_modules

  • pnpm install --fix-lockfile

    Fix broken lockfile entries without a full reinstall

  • pnpm install --reporter=silent

    Install dependencies suppressing all output except errors

  • pnpm install --reporter=append-only

    Install with append-only progress output suitable for CI logs

  • pnpm add express

    Install the latest version of express as a production dependency

  • pnpm add express@4.18.2

    Install a specific version of express as a production dependency

  • pnpm add express@latest

    Install the latest tagged version of express

  • pnpm add express@^4.0.0

    Install express at the latest version matching the given semver range

  • pnpm add express --save-exact

    Install express and pin the exact version in package.json

  • pnpm add typescript --save-dev

    Install typescript as a development dependency

  • pnpm add typescript --save-dev --save-exact

    Install an exact version of typescript as a devDependency

  • pnpm add lodash --save-optional

    Install lodash as an optional dependency

  • pnpm add lodash --save-peer

    Install lodash as a peer dependency

  • pnpm add -g typescript

    Install typescript globally

  • pnpm add -g pnpm@latest

    Update pnpm itself to the latest version globally

  • pnpm add react react-dom

    Install multiple packages simultaneously as production dependencies

  • pnpm add @types/node --save-dev

    Install a scoped package as a devDependency

  • pnpm add git+https://github.com/user/repo.git

    Install a package directly from a GitHub repository URL

  • pnpm add github:user/repo

    Install a package from a GitHub shorthand reference

  • pnpm add github:user/repo#branch

    Install a package from a specific branch of a GitHub repository

  • pnpm add ./path/to/local-package

    Install a package from a local directory path

  • pnpm add file:./packages/my-lib

    Install a local package using the file: protocol

  • pnpm add https://example.com/package.tgz

    Install a package from a remote tarball URL

Remove Packages

  • pnpm remove express

    Remove express from node_modules and package.json dependencies

  • pnpm remove typescript --save-dev

    Remove typescript from node_modules and devDependencies

  • pnpm remove lodash --save-optional

    Remove lodash from node_modules and optionalDependencies

  • pnpm remove -g typescript

    Remove a globally installed package

  • pnpm remove react react-dom

    Remove multiple packages simultaneously

Update Packages

  • pnpm update

    Update all packages to the latest version within their semver range

  • pnpm update express

    Update express to the latest version within its semver range

  • pnpm update --latest

    Update all packages to the absolute latest version, ignoring semver ranges

  • pnpm update express --latest

    Update express to the absolute latest version ignoring semver range

  • pnpm update --dev

    Update only devDependencies within their semver ranges

  • pnpm update --prod

    Update only production dependencies within their semver ranges

  • pnpm update --global

    Update all globally installed packages

  • pnpm update --global typescript

    Update a specific globally installed package

  • pnpm update --recursive

    Update packages in all workspace projects

  • pnpm update --recursive --latest

    Update all packages to latest across all workspace projects

  • pnpm update --interactive

    Interactively select which packages to update

  • pnpm update --interactive --latest

    Interactively select packages to update to their latest versions

Scripts & Execution

  • pnpm run build

    Execute the build script defined in package.json

  • pnpm run dev

    Execute the dev script defined in package.json

  • pnpm run test

    Execute the test script defined in package.json

  • pnpm run lint

    Execute the lint script defined in package.json

  • pnpm run start

    Execute the start script defined in package.json

  • pnpm start

    Run the start script shorthand

  • pnpm test

    Run the test script shorthand

  • pnpm build

    Run the build script shorthand if no pnpm subcommand conflicts

  • pnpm run build -- --watch

    Pass additional arguments to a script after the double-dash separator

  • pnpm run build --if-present

    Run the build script only if it exists, without erroring if absent

  • pnpm run --parallel test

    Run the test script in all workspace packages in parallel

  • pnpm run --stream build

    Run the build script in workspaces and stream output with package prefix

  • pnpm run --sequential build

    Run the build script in all workspace packages sequentially

  • pnpm run --filter @myorg/app build

    Run the build script only in a specific filtered workspace package

  • pnpm exec tsc

    Execute a locally installed binary from node_modules/.bin

  • pnpm exec -- tsc --init

    Execute a local binary with additional arguments

  • pnpm dlx create-react-app my-app

    Fetch and execute a package binary without installing it permanently

  • pnpm dlx --package=typescript tsc --init

    Specify the package to fetch and then run its binary

  • pnpm dlx create-next-app@latest my-app

    Fetch and run a specific version of a package binary

Workspaces

  • pnpm install --recursive

    Install dependencies for all packages in the workspace

  • pnpm add lodash --filter @myorg/app

    Add a dependency to a specific filtered workspace package

  • pnpm add lodash --workspace

    Add a dependency referencing another package within the workspace

  • pnpm run build --recursive

    Run the build script in all workspace packages respecting dependency order

  • pnpm run build --filter @myorg/app

    Run the build script in a specific workspace package

  • pnpm run build --filter @myorg/app...

    Run build in a package and all packages that depend on it

  • pnpm run build --filter ...@myorg/app

    Run build in a package and all its dependencies

  • pnpm run test --filter ./packages/**

    Run test script in all packages matching a glob path pattern

  • pnpm run test --filter @myorg/* --parallel

    Run test in all scoped packages in parallel

  • pnpm run build --filter {packages/**}

    Run build in all packages within a specific directory using brace glob

  • pnpm run build --filter "[origin/main]"

    Run build only in packages changed since the origin/main branch

  • pnpm list --recursive

    List installed packages across all workspace projects

  • pnpm outdated --recursive

    Check for outdated packages across all workspace projects

  • pnpm publish --recursive

    Publish all changed workspace packages to the registry

  • pnpm exec --recursive -- tsc --noEmit

    Execute a binary in all workspace packages

Publish & Registry

  • pnpm publish

    Publish the current package to the npm registry

  • pnpm publish --access public

    Publish a scoped package publicly to the npm registry

  • pnpm publish --access restricted

    Publish a package as restricted (private)

  • pnpm publish --tag beta

    Publish the package under a custom dist-tag instead of latest

  • pnpm publish --dry-run

    Simulate publishing without uploading anything to the registry

  • pnpm publish --otp 123456

    Publish using a one-time password for 2FA-enabled accounts

  • pnpm publish --no-git-checks

    Publish without verifying a clean git state or branch

  • pnpm publish --recursive

    Publish all workspace packages that have changed

  • pnpm pack

    Create a .tgz tarball of the current package without publishing

  • pnpm pack --dry-run

    List files that would be included in the tarball without creating it

Authentication

  • pnpm login

    Log in to the npm registry interactively

  • pnpm login --registry https://registry.npmjs.org/

    Log in to a specific npm registry

  • pnpm login --scope=@myorg

    Associate a scope with a specific registry and log in

  • pnpm logout

    Log out from the npm registry, removing stored auth tokens

  • pnpm logout --registry https://registry.npmjs.org/

    Log out from a specific registry

  • pnpm whoami

    Display the currently authenticated npm username

  • pnpm whoami --registry https://registry.npmjs.org/

    Display the authenticated username for a specific registry

Info & Search

  • pnpm info express

    Display metadata for the express package from the registry

  • pnpm info express version

    Display only the latest version of express

  • pnpm info express versions

    List all published versions of express

  • pnpm info express dependencies

    Display the dependencies of the latest express version

  • pnpm info express --json

    Display full package metadata as JSON

  • pnpm info express@4.18.2 dependencies

    Show dependencies for a specific version of express

Listing & Dependency Tree

  • pnpm list

    List installed packages and their dependency tree in the current project

  • pnpm list --depth=0

    List only top-level installed packages without sub-dependencies

  • pnpm list --depth=1

    List installed packages up to one level of sub-dependencies

  • pnpm list --json

    Output the installed dependency tree in JSON format

  • pnpm list --prod

    List only production dependencies in the tree

  • pnpm list --dev

    List only development dependencies in the tree

  • pnpm list express

    Check if express is installed and show its resolved version

  • pnpm list --global

    List all globally installed packages

  • pnpm list --global --depth=0

    List top-level globally installed packages only

  • pnpm list --recursive

    List packages across all workspace projects

  • pnpm list --recursive --depth=0

    List top-level packages across all workspace projects

  • pnpm why express

    Explain why express is installed and which packages depend on it

  • pnpm why express --recursive

    Explain why express is installed across all workspace projects

  • pnpm why express --json

    Output the dependency explanation for express as JSON

Audit & Security

  • pnpm audit

    Scan installed dependencies for known security vulnerabilities

  • pnpm audit --json

    Output vulnerability audit results as JSON

  • pnpm audit --prod

    Audit only production dependencies for vulnerabilities

  • pnpm audit --dev

    Audit only devDependencies for vulnerabilities

  • pnpm audit --audit-level=critical

    Exit with error only if critical severity vulnerabilities are found

  • pnpm audit --audit-level=high

    Exit with error if high or critical severity vulnerabilities are found

  • pnpm audit --audit-level=moderate

    Exit with error if moderate or higher severity vulnerabilities are found

  • pnpm audit fix

    Automatically fix vulnerabilities by updating affected packages

  • pnpm audit fix --force

    Force fix vulnerabilities even if it requires breaking semver changes

Versioning

  • pnpm version patch

    Increment the patch version in package.json and create a git tag

  • pnpm version minor

    Increment the minor version in package.json and create a git tag

  • pnpm version major

    Increment the major version in package.json and create a git tag

  • pnpm version prepatch

    Increment to the next prepatch prerelease version

  • pnpm version preminor

    Increment to the next preminor prerelease version

  • pnpm version premajor

    Increment to the next premajor prerelease version

  • pnpm version prerelease

    Increment the prerelease number of the current version

  • pnpm version prerelease --preid=alpha

    Increment the prerelease version with a custom alpha identifier

  • pnpm version prerelease --preid=beta

    Increment the prerelease version with a custom beta identifier

  • pnpm version 2.0.0

    Set an explicit version number in package.json

  • pnpm version patch --no-git-tag-version

    Increment patch version without creating a git commit or tag

  • pnpm version patch -m "chore: release v%s"

    Increment patch version with a custom git commit message

Store Management

  • pnpm store path

    Print the path to the current pnpm content-addressable store

  • pnpm store status

    Check the integrity of packages currently in the store

  • pnpm store add express

    Add a package to the store without linking it to any project

  • pnpm store add express@4.18.2

    Add a specific version of a package to the store

  • pnpm store prune

    Remove unreferenced packages from the content-addressable store

Outdated

  • pnpm outdated

    Check which installed packages have newer versions available

  • pnpm outdated --json

    Output outdated package information as JSON

  • pnpm outdated --long

    Show extended information including package links in outdated output

  • pnpm outdated --dev

    Check outdated status for devDependencies only

  • pnpm outdated --prod

    Check outdated status for production dependencies only

  • pnpm outdated --global

    Check for outdated globally installed packages

  • pnpm outdated --recursive

    Check for outdated packages across all workspace projects

Linking

  • pnpm link --global

    Create a global symlink for the current package for local development

  • pnpm link --global my-package

    Link a globally registered package into the current project

  • pnpm link ./path/to/local-package

    Link a local directory as a dependency in the current project

  • pnpm unlink

    Remove all symlinks created for the current project

  • pnpm unlink --global my-package

    Remove a globally linked package

Patching

  • pnpm patch express

    Prepare a package for patching by extracting it to a temporary directory

  • pnpm patch express@4.18.2

    Prepare a specific version of a package for patching

  • pnpm patch-commit /tmp/express

    Generate and save a patch file from a modified temporary package directory

  • pnpm patch-remove express

    Remove a previously applied patch for a package

Miscellaneous

  • pnpm root

    Print the path to the local node_modules directory

  • pnpm root --global

    Print the path to the global node_modules directory

  • pnpm bin

    Print the path to the local .bin executables directory

  • pnpm bin --global

    Print the path to the global bin executables directory

  • pnpm rebuild

    Rebuild all native addons for the current Node.js version

  • pnpm rebuild bcrypt

    Rebuild a specific native addon package

  • pnpm dedupe

    Reduce duplication in the lockfile by resolving shared package versions

  • pnpm dedupe --check

    Check if deduplication is possible without modifying the lockfile

  • pnpm prune

    Remove extraneous packages from node_modules not in package.json

  • pnpm prune --prod

    Remove devDependency packages from node_modules for production

  • pnpm fund

    Display funding information for all installed packages

  • pnpm doctor

    Run environment checks to verify pnpm is configured correctly

  • pnpm --version

    Display the currently installed version of pnpm

  • pnpm env use --global lts

    Install and use the latest LTS version of Node.js globally via pnpm

  • pnpm env use --global 20

    Install and use Node.js version 20 globally via pnpm

  • pnpm env use --global latest

    Install and use the latest Node.js version globally via pnpm

  • pnpm env list

    List all Node.js versions installed via pnpm

  • pnpm env list --remote

    List available Node.js versions from the remote registry

  • pnpm env remove --global 18

    Remove a specific Node.js version installed via pnpm

  • pnpm licenses list

    List the licenses of all installed dependencies

  • pnpm licenses list --json

    Output license information for all installed dependencies as JSON