Init & Config
Create a package.json file with all defaults in the current directory
$pnpm initSet the default npm registry URL for pnpm
$pnpm config set registry https://registry.npmjs.org/Get the currently configured registry URL
$pnpm config get registryRemove the registry config key, reverting to default
$pnpm config delete registryList all active pnpm configuration values
$pnpm config listList all pnpm config values in JSON format
$pnpm config list --jsonConfigure pnpm to save exact versions instead of semver ranges
$pnpm config set save-exact trueSet a custom directory for the pnpm content-addressable store
$pnpm config set store-dir /path/to/storeSet the directory for globally installed packages
$pnpm config set global-dir /path/to/globalSet the directory where global package binaries are linked
$pnpm config set global-bin-dir /usr/local/binHoist all dependencies to node_modules root for maximum compatibility
$pnpm config set shamefully-hoist trueSet a glob pattern for which packages to hoist to the root node_modules
$pnpm config set hoist-pattern *Set a pattern for packages to hoist to the root for tooling access
$pnpm config set public-hoist-pattern *eslint*Set the node linker strategy to hoisted for compatibility with npm layout
$pnpm config set node-linker hoistedSet the node linker strategy to isolated for strict dependency isolation
$pnpm config set node-linker isolatedAutomatically install missing peer dependencies
$pnpm config set auto-install-peers trueDisable errors on missing or incompatible peer dependencies
$pnpm config set strict-peer-dependencies falseAlways use the lockfile as-is without attempting updates
$pnpm config set prefer-frozen-lockfile trueSet an HTTP proxy for pnpm network requests
$pnpm config set proxy http://proxy.example.com:8080Set an HTTPS proxy for pnpm network requests
$pnpm config set https-proxy http://proxy.example.com:8080Install & Add Packages
Install all dependencies listed in package.json using the lockfile
$pnpm installInstall only production dependencies, skipping devDependencies
$pnpm install --prodInstall only devDependencies
$pnpm install --devInstall dependencies without updating the lockfile, failing if out of sync
$pnpm install --frozen-lockfileInstall dependencies and allow updating the lockfile if needed
$pnpm install --no-frozen-lockfileForce reinstall all packages, bypassing the store cache
$pnpm install --forceInstall packages without running any lifecycle scripts
$pnpm install --ignore-scriptsUse cached packages when available, falling back to network
$pnpm install --prefer-offlineInstall using only the local store, failing if any package is missing
$pnpm install --offlineHoist all packages to root node_modules for this install
$pnpm install --shamefully-hoistUpdate the lockfile without installing anything into node_modules
$pnpm install --resolution-onlyUpdate pnpm-lock.yaml only without touching node_modules
$pnpm install --lockfile-onlyFix broken lockfile entries without a full reinstall
$pnpm install --fix-lockfileInstall dependencies suppressing all output except errors
$pnpm install --reporter=silentInstall with append-only progress output suitable for CI logs
$pnpm install --reporter=append-onlyInstall the latest version of express as a production dependency
$pnpm add expressInstall a specific version of express as a production dependency
$pnpm add express@4.18.2Install the latest tagged version of express
$pnpm add express@latestInstall express at the latest version matching the given semver range
$pnpm add express@^4.0.0Install express and pin the exact version in package.json
$pnpm add express --save-exactInstall typescript as a development dependency
$pnpm add typescript --save-devInstall an exact version of typescript as a devDependency
$pnpm add typescript --save-dev --save-exactInstall lodash as an optional dependency
$pnpm add lodash --save-optionalInstall lodash as a peer dependency
$pnpm add lodash --save-peerInstall typescript globally
$pnpm add -g typescriptUpdate pnpm itself to the latest version globally
$pnpm add -g pnpm@latestInstall multiple packages simultaneously as production dependencies
$pnpm add react react-domInstall a scoped package as a devDependency
$pnpm add @types/node --save-devInstall a package directly from a GitHub repository URL
$pnpm add git+https://github.com/user/repo.gitInstall a package from a GitHub shorthand reference
$pnpm add github:user/repoInstall a package from a specific branch of a GitHub repository
$pnpm add github:user/repo#branchInstall a package from a local directory path
$pnpm add ./path/to/local-packageInstall a local package using the file: protocol
$pnpm add file:./packages/my-libInstall a package from a remote tarball URL
$pnpm add https://example.com/package.tgzRemove Packages
Remove express from node_modules and package.json dependencies
$pnpm remove expressRemove typescript from node_modules and devDependencies
$pnpm remove typescript --save-devRemove lodash from node_modules and optionalDependencies
$pnpm remove lodash --save-optionalRemove a globally installed package
$pnpm remove -g typescriptRemove multiple packages simultaneously
$pnpm remove react react-domUpdate Packages
Update all packages to the latest version within their semver range
$pnpm updateUpdate express to the latest version within its semver range
$pnpm update expressUpdate all packages to the absolute latest version, ignoring semver ranges
$pnpm update --latestUpdate express to the absolute latest version ignoring semver range
$pnpm update express --latestUpdate only devDependencies within their semver ranges
$pnpm update --devUpdate only production dependencies within their semver ranges
$pnpm update --prodUpdate all globally installed packages
$pnpm update --globalUpdate a specific globally installed package
$pnpm update --global typescriptUpdate packages in all workspace projects
$pnpm update --recursiveUpdate all packages to latest across all workspace projects
$pnpm update --recursive --latestInteractively select which packages to update
$pnpm update --interactiveInteractively select packages to update to their latest versions
$pnpm update --interactive --latestScripts & Execution
Execute the build script defined in package.json
$pnpm run buildExecute the dev script defined in package.json
$pnpm run devExecute the test script defined in package.json
$pnpm run testExecute the lint script defined in package.json
$pnpm run lintExecute the start script defined in package.json
$pnpm run startRun the start script shorthand
$pnpm startRun the test script shorthand
$pnpm testRun the build script shorthand if no pnpm subcommand conflicts
$pnpm buildPass additional arguments to a script after the double-dash separator
$pnpm run build -- --watchRun the build script only if it exists, without erroring if absent
$pnpm run build --if-presentRun the test script in all workspace packages in parallel
$pnpm run --parallel testRun the build script in workspaces and stream output with package prefix
$pnpm run --stream buildRun the build script in all workspace packages sequentially
$pnpm run --sequential buildRun the build script only in a specific filtered workspace package
$pnpm run --filter @myorg/app buildExecute a locally installed binary from node_modules/.bin
$pnpm exec tscExecute a local binary with additional arguments
$pnpm exec -- tsc --initFetch and execute a package binary without installing it permanently
$pnpm dlx create-react-app my-appSpecify the package to fetch and then run its binary
$pnpm dlx --package=typescript tsc --initFetch and run a specific version of a package binary
$pnpm dlx create-next-app@latest my-appWorkspaces
Install dependencies for all packages in the workspace
$pnpm install --recursiveAdd a dependency to a specific filtered workspace package
$pnpm add lodash --filter @myorg/appAdd a dependency referencing another package within the workspace
$pnpm add lodash --workspaceRun the build script in all workspace packages respecting dependency order
$pnpm run build --recursiveRun the build script in a specific workspace package
$pnpm run build --filter @myorg/appRun 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 build --filter ...@myorg/appRun test script in all packages matching a glob path pattern
$pnpm run test --filter ./packages/**Run test in all scoped packages in parallel
$pnpm run test --filter @myorg/* --parallelRun build in all packages within a specific directory using brace glob
$pnpm run build --filter {packages/**}Run build only in packages changed since the origin/main branch
$pnpm run build --filter "[origin/main]"List installed packages across all workspace projects
$pnpm list --recursiveCheck for outdated packages across all workspace projects
$pnpm outdated --recursivePublish all changed workspace packages to the registry
$pnpm publish --recursiveExecute a binary in all workspace packages
$pnpm exec --recursive -- tsc --noEmitPublish & Registry
Publish the current package to the npm registry
$pnpm publishPublish a scoped package publicly to the npm registry
$pnpm publish --access publicPublish a package as restricted (private)
$pnpm publish --access restrictedPublish the package under a custom dist-tag instead of latest
$pnpm publish --tag betaSimulate publishing without uploading anything to the registry
$pnpm publish --dry-runPublish using a one-time password for 2FA-enabled accounts
$pnpm publish --otp 123456Publish without verifying a clean git state or branch
$pnpm publish --no-git-checksPublish all workspace packages that have changed
$pnpm publish --recursiveCreate a .tgz tarball of the current package without publishing
$pnpm packList files that would be included in the tarball without creating it
$pnpm pack --dry-runAuthentication
Log in to the npm registry interactively
$pnpm loginLog in to a specific npm registry
$pnpm login --registry https://registry.npmjs.org/Associate a scope with a specific registry and log in
$pnpm login --scope=@myorgLog out from the npm registry, removing stored auth tokens
$pnpm logoutLog out from a specific registry
$pnpm logout --registry https://registry.npmjs.org/Display the currently authenticated npm username
$pnpm whoamiDisplay the authenticated username for a specific registry
$pnpm whoami --registry https://registry.npmjs.org/Info & Search
Display metadata for the express package from the registry
$pnpm info expressDisplay only the latest version of express
$pnpm info express versionList all published versions of express
$pnpm info express versionsDisplay the dependencies of the latest express version
$pnpm info express dependenciesDisplay full package metadata as JSON
$pnpm info express --jsonShow dependencies for a specific version of express
$pnpm info express@4.18.2 dependenciesListing & Dependency Tree
List installed packages and their dependency tree in the current project
$pnpm listList only top-level installed packages without sub-dependencies
$pnpm list --depth=0List installed packages up to one level of sub-dependencies
$pnpm list --depth=1Output the installed dependency tree in JSON format
$pnpm list --jsonList only production dependencies in the tree
$pnpm list --prodList only development dependencies in the tree
$pnpm list --devCheck if express is installed and show its resolved version
$pnpm list expressList all globally installed packages
$pnpm list --globalList top-level globally installed packages only
$pnpm list --global --depth=0List packages across all workspace projects
$pnpm list --recursiveList top-level packages across all workspace projects
$pnpm list --recursive --depth=0Explain why express is installed and which packages depend on it
$pnpm why expressExplain why express is installed across all workspace projects
$pnpm why express --recursiveOutput the dependency explanation for express as JSON
$pnpm why express --jsonAudit & Security
Scan installed dependencies for known security vulnerabilities
$pnpm auditOutput vulnerability audit results as JSON
$pnpm audit --jsonAudit only production dependencies for vulnerabilities
$pnpm audit --prodAudit only devDependencies for vulnerabilities
$pnpm audit --devExit with error only if critical severity vulnerabilities are found
$pnpm audit --audit-level=criticalExit with error if high or critical severity vulnerabilities are found
$pnpm audit --audit-level=highExit with error if moderate or higher severity vulnerabilities are found
$pnpm audit --audit-level=moderateAutomatically fix vulnerabilities by updating affected packages
$pnpm audit fixForce fix vulnerabilities even if it requires breaking semver changes
$pnpm audit fix --forceVersioning
Increment the patch version in package.json and create a git tag
$pnpm version patchIncrement the minor version in package.json and create a git tag
$pnpm version minorIncrement the major version in package.json and create a git tag
$pnpm version majorIncrement to the next prepatch prerelease version
$pnpm version prepatchIncrement to the next preminor prerelease version
$pnpm version preminorIncrement to the next premajor prerelease version
$pnpm version premajorIncrement the prerelease number of the current version
$pnpm version prereleaseIncrement the prerelease version with a custom alpha identifier
$pnpm version prerelease --preid=alphaIncrement the prerelease version with a custom beta identifier
$pnpm version prerelease --preid=betaSet an explicit version number in package.json
$pnpm version 2.0.0Increment patch version without creating a git commit or tag
$pnpm version patch --no-git-tag-versionIncrement patch version with a custom git commit message
$pnpm version patch -m "chore: release v%s"Store Management
Print the path to the current pnpm content-addressable store
$pnpm store pathCheck the integrity of packages currently in the store
$pnpm store statusAdd a package to the store without linking it to any project
$pnpm store add expressAdd a specific version of a package to the store
$pnpm store add express@4.18.2Remove unreferenced packages from the content-addressable store
$pnpm store pruneOutdated
Check which installed packages have newer versions available
$pnpm outdatedOutput outdated package information as JSON
$pnpm outdated --jsonShow extended information including package links in outdated output
$pnpm outdated --longCheck outdated status for devDependencies only
$pnpm outdated --devCheck outdated status for production dependencies only
$pnpm outdated --prodCheck for outdated globally installed packages
$pnpm outdated --globalCheck for outdated packages across all workspace projects
$pnpm outdated --recursiveLinking
Create a global symlink for the current package for local development
$pnpm link --globalLink a globally registered package into the current project
$pnpm link --global my-packageLink a local directory as a dependency in the current project
$pnpm link ./path/to/local-packageRemove all symlinks created for the current project
$pnpm unlinkRemove a globally linked package
$pnpm unlink --global my-packagePatching
Prepare a package for patching by extracting it to a temporary directory
$pnpm patch expressPrepare a specific version of a package for patching
$pnpm patch express@4.18.2Generate and save a patch file from a modified temporary package directory
$pnpm patch-commit /tmp/expressRemove a previously applied patch for a package
$pnpm patch-remove expressMiscellaneous
Print the path to the local node_modules directory
$pnpm rootPrint the path to the global node_modules directory
$pnpm root --globalPrint the path to the local .bin executables directory
$pnpm binPrint the path to the global bin executables directory
$pnpm bin --globalRebuild all native addons for the current Node.js version
$pnpm rebuildRebuild a specific native addon package
$pnpm rebuild bcryptReduce duplication in the lockfile by resolving shared package versions
$pnpm dedupeCheck if deduplication is possible without modifying the lockfile
$pnpm dedupe --checkRemove extraneous packages from node_modules not in package.json
$pnpm pruneRemove devDependency packages from node_modules for production
$pnpm prune --prodDisplay funding information for all installed packages
$pnpm fundRun environment checks to verify pnpm is configured correctly
$pnpm doctorDisplay the currently installed version of pnpm
$pnpm --versionInstall and use the latest LTS version of Node.js globally via pnpm
$pnpm env use --global ltsInstall and use Node.js version 20 globally via pnpm
$pnpm env use --global 20Install and use the latest Node.js version globally via pnpm
$pnpm env use --global latestList all Node.js versions installed via pnpm
$pnpm env listList available Node.js versions from the remote registry
$pnpm env list --remoteRemove a specific Node.js version installed via pnpm
$pnpm env remove --global 18List the licenses of all installed dependencies
$pnpm licenses listOutput license information for all installed dependencies as JSON
$pnpm licenses list --json