PNPM commands
Fast, disk space efficient package manager for Node.js
Init & Config
pnpm initCreate 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 registryGet the currently configured registry URL
pnpm config delete registryRemove the registry config key, reverting to default
pnpm config listList all active pnpm configuration values
pnpm config list --jsonList all pnpm config values in JSON format
pnpm config set save-exact trueConfigure pnpm to save exact versions instead of semver ranges
pnpm config set store-dir /path/to/storeSet a custom directory for the pnpm content-addressable store
pnpm config set global-dir /path/to/globalSet the directory for globally installed packages
pnpm config set global-bin-dir /usr/local/binSet the directory where global package binaries are linked
pnpm config set shamefully-hoist trueHoist 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 hoistedSet the node linker strategy to hoisted for compatibility with npm layout
pnpm config set node-linker isolatedSet the node linker strategy to isolated for strict dependency isolation
pnpm config set auto-install-peers trueAutomatically install missing peer dependencies
pnpm config set strict-peer-dependencies falseDisable errors on missing or incompatible peer dependencies
pnpm config set prefer-frozen-lockfile trueAlways use the lockfile as-is without attempting updates
pnpm config set proxy http://proxy.example.com:8080Set an HTTP proxy for pnpm network requests
pnpm config set https-proxy http://proxy.example.com:8080Set an HTTPS proxy for pnpm network requests
Install & Add Packages
pnpm installInstall all dependencies listed in package.json using the lockfile
pnpm install --prodInstall only production dependencies, skipping devDependencies
pnpm install --devInstall only devDependencies
pnpm install --frozen-lockfileInstall dependencies without updating the lockfile, failing if out of sync
pnpm install --no-frozen-lockfileInstall dependencies and allow updating the lockfile if needed
pnpm install --forceForce reinstall all packages, bypassing the store cache
pnpm install --ignore-scriptsInstall packages without running any lifecycle scripts
pnpm install --prefer-offlineUse cached packages when available, falling back to network
pnpm install --offlineInstall using only the local store, failing if any package is missing
pnpm install --shamefully-hoistHoist all packages to root node_modules for this install
pnpm install --resolution-onlyUpdate the lockfile without installing anything into node_modules
pnpm install --lockfile-onlyUpdate pnpm-lock.yaml only without touching node_modules
pnpm install --fix-lockfileFix broken lockfile entries without a full reinstall
pnpm install --reporter=silentInstall dependencies suppressing all output except errors
pnpm install --reporter=append-onlyInstall with append-only progress output suitable for CI logs
pnpm add expressInstall the latest version of express as a production dependency
pnpm add express@4.18.2Install a specific version of express as a production dependency
pnpm add express@latestInstall the latest tagged version of express
pnpm add express@^4.0.0Install express at the latest version matching the given semver range
pnpm add express --save-exactInstall express and pin the exact version in package.json
pnpm add typescript --save-devInstall typescript as a development dependency
pnpm add typescript --save-dev --save-exactInstall an exact version of typescript as a devDependency
pnpm add lodash --save-optionalInstall lodash as an optional dependency
pnpm add lodash --save-peerInstall lodash as a peer dependency
pnpm add -g typescriptInstall typescript globally
pnpm add -g pnpm@latestUpdate pnpm itself to the latest version globally
pnpm add react react-domInstall multiple packages simultaneously as production dependencies
pnpm add @types/node --save-devInstall a scoped package as a devDependency
pnpm add git+https://github.com/user/repo.gitInstall a package directly from a GitHub repository URL
pnpm add github:user/repoInstall a package from a GitHub shorthand reference
pnpm add github:user/repo#branchInstall a package from a specific branch of a GitHub repository
pnpm add ./path/to/local-packageInstall a package from a local directory path
pnpm add file:./packages/my-libInstall a local package using the file: protocol
pnpm add https://example.com/package.tgzInstall a package from a remote tarball URL
Remove Packages
pnpm remove expressRemove express from node_modules and package.json dependencies
pnpm remove typescript --save-devRemove typescript from node_modules and devDependencies
pnpm remove lodash --save-optionalRemove lodash from node_modules and optionalDependencies
pnpm remove -g typescriptRemove a globally installed package
pnpm remove react react-domRemove multiple packages simultaneously
Update Packages
pnpm updateUpdate all packages to the latest version within their semver range
pnpm update expressUpdate express to the latest version within its semver range
pnpm update --latestUpdate all packages to the absolute latest version, ignoring semver ranges
pnpm update express --latestUpdate express to the absolute latest version ignoring semver range
pnpm update --devUpdate only devDependencies within their semver ranges
pnpm update --prodUpdate only production dependencies within their semver ranges
pnpm update --globalUpdate all globally installed packages
pnpm update --global typescriptUpdate a specific globally installed package
pnpm update --recursiveUpdate packages in all workspace projects
pnpm update --recursive --latestUpdate all packages to latest across all workspace projects
pnpm update --interactiveInteractively select which packages to update
pnpm update --interactive --latestInteractively select packages to update to their latest versions
Scripts & Execution
pnpm run buildExecute the build script defined in package.json
pnpm run devExecute the dev script defined in package.json
pnpm run testExecute the test script defined in package.json
pnpm run lintExecute the lint script defined in package.json
pnpm run startExecute the start script defined in package.json
pnpm startRun the start script shorthand
pnpm testRun the test script shorthand
pnpm buildRun the build script shorthand if no pnpm subcommand conflicts
pnpm run build -- --watchPass additional arguments to a script after the double-dash separator
pnpm run build --if-presentRun the build script only if it exists, without erroring if absent
pnpm run --parallel testRun the test script in all workspace packages in parallel
pnpm run --stream buildRun the build script in workspaces and stream output with package prefix
pnpm run --sequential buildRun the build script in all workspace packages sequentially
pnpm run --filter @myorg/app buildRun the build script only in a specific filtered workspace package
pnpm exec tscExecute a locally installed binary from node_modules/.bin
pnpm exec -- tsc --initExecute a local binary with additional arguments
pnpm dlx create-react-app my-appFetch and execute a package binary without installing it permanently
pnpm dlx --package=typescript tsc --initSpecify the package to fetch and then run its binary
pnpm dlx create-next-app@latest my-appFetch and run a specific version of a package binary
Workspaces
pnpm install --recursiveInstall dependencies for all packages in the workspace
pnpm add lodash --filter @myorg/appAdd a dependency to a specific filtered workspace package
pnpm add lodash --workspaceAdd a dependency referencing another package within the workspace
pnpm run build --recursiveRun the build script in all workspace packages respecting dependency order
pnpm run build --filter @myorg/appRun 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/appRun 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/* --parallelRun 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 --recursiveList installed packages across all workspace projects
pnpm outdated --recursiveCheck for outdated packages across all workspace projects
pnpm publish --recursivePublish all changed workspace packages to the registry
pnpm exec --recursive -- tsc --noEmitExecute a binary in all workspace packages
Publish & Registry
pnpm publishPublish the current package to the npm registry
pnpm publish --access publicPublish a scoped package publicly to the npm registry
pnpm publish --access restrictedPublish a package as restricted (private)
pnpm publish --tag betaPublish the package under a custom dist-tag instead of latest
pnpm publish --dry-runSimulate publishing without uploading anything to the registry
pnpm publish --otp 123456Publish using a one-time password for 2FA-enabled accounts
pnpm publish --no-git-checksPublish without verifying a clean git state or branch
pnpm publish --recursivePublish all workspace packages that have changed
pnpm packCreate a .tgz tarball of the current package without publishing
pnpm pack --dry-runList files that would be included in the tarball without creating it
Authentication
pnpm loginLog in to the npm registry interactively
pnpm login --registry https://registry.npmjs.org/Log in to a specific npm registry
pnpm login --scope=@myorgAssociate a scope with a specific registry and log in
pnpm logoutLog out from the npm registry, removing stored auth tokens
pnpm logout --registry https://registry.npmjs.org/Log out from a specific registry
pnpm whoamiDisplay the currently authenticated npm username
pnpm whoami --registry https://registry.npmjs.org/Display the authenticated username for a specific registry
Info & Search
pnpm info expressDisplay metadata for the express package from the registry
pnpm info express versionDisplay only the latest version of express
pnpm info express versionsList all published versions of express
pnpm info express dependenciesDisplay the dependencies of the latest express version
pnpm info express --jsonDisplay full package metadata as JSON
pnpm info express@4.18.2 dependenciesShow dependencies for a specific version of express
Listing & Dependency Tree
pnpm listList installed packages and their dependency tree in the current project
pnpm list --depth=0List only top-level installed packages without sub-dependencies
pnpm list --depth=1List installed packages up to one level of sub-dependencies
pnpm list --jsonOutput the installed dependency tree in JSON format
pnpm list --prodList only production dependencies in the tree
pnpm list --devList only development dependencies in the tree
pnpm list expressCheck if express is installed and show its resolved version
pnpm list --globalList all globally installed packages
pnpm list --global --depth=0List top-level globally installed packages only
pnpm list --recursiveList packages across all workspace projects
pnpm list --recursive --depth=0List top-level packages across all workspace projects
pnpm why expressExplain why express is installed and which packages depend on it
pnpm why express --recursiveExplain why express is installed across all workspace projects
pnpm why express --jsonOutput the dependency explanation for express as JSON
Audit & Security
pnpm auditScan installed dependencies for known security vulnerabilities
pnpm audit --jsonOutput vulnerability audit results as JSON
pnpm audit --prodAudit only production dependencies for vulnerabilities
pnpm audit --devAudit only devDependencies for vulnerabilities
pnpm audit --audit-level=criticalExit with error only if critical severity vulnerabilities are found
pnpm audit --audit-level=highExit with error if high or critical severity vulnerabilities are found
pnpm audit --audit-level=moderateExit with error if moderate or higher severity vulnerabilities are found
pnpm audit fixAutomatically fix vulnerabilities by updating affected packages
pnpm audit fix --forceForce fix vulnerabilities even if it requires breaking semver changes
Versioning
pnpm version patchIncrement the patch version in package.json and create a git tag
pnpm version minorIncrement the minor version in package.json and create a git tag
pnpm version majorIncrement the major version in package.json and create a git tag
pnpm version prepatchIncrement to the next prepatch prerelease version
pnpm version preminorIncrement to the next preminor prerelease version
pnpm version premajorIncrement to the next premajor prerelease version
pnpm version prereleaseIncrement the prerelease number of the current version
pnpm version prerelease --preid=alphaIncrement the prerelease version with a custom alpha identifier
pnpm version prerelease --preid=betaIncrement the prerelease version with a custom beta identifier
pnpm version 2.0.0Set an explicit version number in package.json
pnpm version patch --no-git-tag-versionIncrement 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 pathPrint the path to the current pnpm content-addressable store
pnpm store statusCheck the integrity of packages currently in the store
pnpm store add expressAdd a package to the store without linking it to any project
pnpm store add express@4.18.2Add a specific version of a package to the store
pnpm store pruneRemove unreferenced packages from the content-addressable store
Outdated
pnpm outdatedCheck which installed packages have newer versions available
pnpm outdated --jsonOutput outdated package information as JSON
pnpm outdated --longShow extended information including package links in outdated output
pnpm outdated --devCheck outdated status for devDependencies only
pnpm outdated --prodCheck outdated status for production dependencies only
pnpm outdated --globalCheck for outdated globally installed packages
pnpm outdated --recursiveCheck for outdated packages across all workspace projects
Linking
pnpm link --globalCreate a global symlink for the current package for local development
pnpm link --global my-packageLink a globally registered package into the current project
pnpm link ./path/to/local-packageLink a local directory as a dependency in the current project
pnpm unlinkRemove all symlinks created for the current project
pnpm unlink --global my-packageRemove a globally linked package
Patching
pnpm patch expressPrepare a package for patching by extracting it to a temporary directory
pnpm patch express@4.18.2Prepare a specific version of a package for patching
pnpm patch-commit /tmp/expressGenerate and save a patch file from a modified temporary package directory
pnpm patch-remove expressRemove a previously applied patch for a package
Miscellaneous
pnpm rootPrint the path to the local node_modules directory
pnpm root --globalPrint the path to the global node_modules directory
pnpm binPrint the path to the local .bin executables directory
pnpm bin --globalPrint the path to the global bin executables directory
pnpm rebuildRebuild all native addons for the current Node.js version
pnpm rebuild bcryptRebuild a specific native addon package
pnpm dedupeReduce duplication in the lockfile by resolving shared package versions
pnpm dedupe --checkCheck if deduplication is possible without modifying the lockfile
pnpm pruneRemove extraneous packages from node_modules not in package.json
pnpm prune --prodRemove devDependency packages from node_modules for production
pnpm fundDisplay funding information for all installed packages
pnpm doctorRun environment checks to verify pnpm is configured correctly
pnpm --versionDisplay the currently installed version of pnpm
pnpm env use --global ltsInstall and use the latest LTS version of Node.js globally via pnpm
pnpm env use --global 20Install and use Node.js version 20 globally via pnpm
pnpm env use --global latestInstall and use the latest Node.js version globally via pnpm
pnpm env listList all Node.js versions installed via pnpm
pnpm env list --remoteList available Node.js versions from the remote registry
pnpm env remove --global 18Remove a specific Node.js version installed via pnpm
pnpm licenses listList the licenses of all installed dependencies
pnpm licenses list --jsonOutput license information for all installed dependencies as JSON