PNpM CLI
This release rejects registry metadata that names a different package than the one requested, applies trustPolicy to the pnpm version a project pins, and caps unpacked package size with maxTarballUnpackedSize. It also removes support for registry revisions, fixes verifyDepsBeforeRun after filtered installs, and finishes commands with their own exit code when a pipe reader exits early.
Patch Changes
Security
-
pnpm now fails with
ERR_PNPM_REGISTRY_NAME_MISMATCHif a registry returns metadata for a package other than the one requested. Before, pnpm installed the package under the name in the metadata, soallowBuildsrules for the requested package did not apply to it. -
pnpm now applies
trustPolicyto the pnpm version a project pins inpackageManagerordevEngines.packageManager. A pinned version whose trust evidence was downgraded fails the command before pnpm switches to it or records it in the lockfile #16319. -
minimumReleaseAgeExcludePruneandtrustPolicyExcludePrunenow keep exclusions for resolved configuration dependencies and their transitive dependencies #17142. -
Added the
maxTarballUnpackedSizesetting.pnpm installfails withERR_PNPM_TARBALL_TOO_LARGEwhen the files of one package unpack to more than this many bytes, 4 GiB by default pnpm/tasks#81.
Resolving dependencies
-
Registry revisions are no longer supported. pnpm now fails with
ERR_PNPM_REGISTRY_REVISIONS_UNSUPPORTEDon registry metadata that selects a revision, on a+rNversion specifier, and on a lockfile entry with arevisionfield.pnpm update --patchesis removed. -
When
pnpm installresolves a dependency again, it now reuses a version that the install already resolved for the same package, as a fresh install does. Before, it kept the version the lockfile pinned and added a second copy of the package. A locked version still stays when nothing else in the install prefers another version. To pin a transitive dependency on purpose, useoverrides#17084. -
When another workspace project adds a different version of a package, a project's auto-installed peer on that package now moves to the version a fresh install picks. It used to stay on its locked version while any other project still accepted that version #17058.
-
An optional peer that pnpm adds to a project now keeps the version the lockfile recorded for that project only while the dependency graph still holds it. Otherwise it follows its provider to a version the graph holds. Before, pnpm kept a higher version that only the lockfile held, which left two copies of the peer #16443.
-
A package that lists the same dependency in
dependenciesand as an optional peer now gets the peer bound when a project adds a provider for it later. The lockfile now records every peer a package declares, including one its own dependency supplies #17056. -
pnpm install --prodno longer drops a dependency that a package declares both as an optional peer and as its own dependency, when the package resolved it as its own dependency and a dev dependency provides the same package under another alias. -
pnpm now measures a
pnpm.overridesentry written as aworkspace:path, such asworkspace:./packages/foo, from the directory holdingpnpm-workspace.yaml. It used to be measured from each package the override rewrote. The install then linked a directory that does not exist, or failed if workspace packages were injected #17010. -
pnpm installnow removes config dependencies that are no longer declared, including when the entireconfigDependenciessetting is removed. Frozen installs reject a lockfile that still records removed config dependencies. -
pnpm addnow reads the package name correctly from a tarball URL under a registry URL that has a path, such ashttps://example.com/npm/. Before, the registry path became part of the name, so a scoped package failed withERR_PNPM_INVALID_PACKAGE_NAME. -
pnpm addno longer warns that a gist dependency was replaced from a different source when the new specifier names the same gist in another form, such asgist:<id>andhttps://gist.github.com/<user>/<id>. -
With
minimumReleaseAgeset, pnpm now revalidates a package's cached full metadata with a single ETag request so an unchanged registry answers with304, and keeps using the cached copy once the registry confirms it is current, even when the metadata does not list a publish time for every version. Previously, pnpm downloaded that metadata again whenever the cached copy was older thanminimumReleaseAge. Packages listed inminimumReleaseAgeExcludealso resolve from cached metadata without a registry request when the lockfile already has the version their range picks.
Linking node_modules and workspaces
-
Concurrent installs that import the same package into one project now all complete. One of them used to fail with
ENOTEMPTYwhen its copy of the package collided with the copy another install had already placed pnpm/tasks#48. -
pnpm installno longer fails on macOS withEISDIRwhen it creates store directories in a group-writable store under a umask that removes owner read, such as0o477. -
pnpm installnow succeeds whennode_modulesis a symlink to an existing directory. Dependency hoisting previously rejected a symlinkednode_modulesas an invalid destination #17157. -
A filtered
pnpm install --no-lockfilewithhoistWorkspacePackagesnow hoists every workspace project intonode_modules/.pnpm/node_modules. It used to hoist only the selected projects pnpm/tasks#168. -
Filtered installs remove obsolete dependencies from the installed lockfile while preserving dependencies still needed by unselected projects.
-
With
sharedWorkspaceLockfile: false,pnpm installnow runs thepreResolutionhooks and custom resolvers and fetchers of the workspace root's pnpmfile for every project, next to the project's own. A global pnpmfile now runs once per project, and each project's lockfile records the checksum of the root pnpmfile when the project has none of its own. Before, a project's own pnpmfile replaced these root hooks, the global hooks ran twice, and edits to the root pnpmfile could go unnoticed. -
pnpm prunenow removes extraneous direct packages fromnode_moduleswhenpackage.jsonandpnpm-lock.yamlare already in sync.pnpm prunealso accepts--filterand--recursiveto prune selected workspace projects without removing dependencies of unselected projects.
Injected workspace packages
-
pnpm install --frozen-lockfilenow fails withERR_PNPM_OUTDATED_LOCKFILEwhen the dependencies of an injected workspace package or local directory dependency no longer match the lockfile. This coverssharedWorkspaceLockfile: false#17008, a dependency changed to a different tarball URL or git commit #17129, and a change in a transitive injected or local directory dependency #17128. -
pnpm install --frozen-lockfileno longer fails withERR_PNPM_OUTDATED_LOCKFILEwhen an injected workspace package depends on a local directory under another name, such as"renamed": "file:../b"#17130. -
An injected workspace dependency now becomes a link when its dependencies match the workspace package's own, also on an install that leaves the package's installed dependencies as they are. Before, such an install kept it as a copy #17094.
-
An injected workspace package that was linked now becomes a copy when the project that depends on it starts providing one of its peers at a version the package's own workspace context lacks. The link used to stay until that dependency was updated, so the package could not find the peer the project provides #17057.
-
An injected workspace package now keeps only the files its manifest lists after a lifecycle script or a script named in
syncInjectedDepsAfterScriptsrebuilds it. Before, these refreshes copied every file of the package directory into the injected copy, including files thatfilesor.npmignoreleave out. WithdeployAllFiles: truethe copy still gets every file. -
A script listed in
syncInjectedDepsAfterScriptsnow keeps a package's links to its own files as links in the injected copies, the waypnpm installwrites them. It no longer fails when the package links to one directory twice or links back to a directory above the link.pnpm installwithdeployAllFilesno longer fails on such a link back either. -
A script listed in
syncInjectedDepsAfterScriptsnow updates the injected copies of the package it ran in whensharedWorkspaceLockfileisfalseor the package publishes frompublishConfig.directory. Before, those copies kept the files from the last install.
Running scripts and checking dependencies
-
When the reader of pnpm's output exits early, as in
pnpm outdated | head, pnpm now finishes the command and exits with the command's own exit code pnpm/tasks#133. It used to exit with code 0 at the first write to the closed pipe. That hid the result of commands such aspnpm outdatedand stoppedpnpm cleanbefore it removed anything. -
With
enableGlobalVirtualStore, a Node.js resolve hook that a script registers now sees the importer ascontext.parentURLafter pnpm'sNODE_PATHfallback fails to find a bare specifier. Hooks that resolve tsconfigpathsaliases from the importer failed withERR_MODULE_NOT_FOUND#16979. -
pnpm run,pnpm exec, andpnpm restartnow pass the install flags they were given, such as--lockfile-dir,--modules-dir,--store-dir,--offline, and--ignore-scripts, to thepnpm installthatverifyDepsBeforeRun: installstarts. When that install leavesnode_modulesout of date, pnpm now prints a warning. -
After
pnpm install --filter,pnpm runandpnpm execnow notice a changed manifest or lockfile in a project that the filtered install left out, including the workspace root after a filtered install withpruneDirectDependencies: truepnpm/tasks#181. A filtered install also preserves the recorded ignored build scripts of unselected projects, andpnpm dedupe --checkandpnpm install --dry-runno longer record outdated dependencies as installed. -
The
verifyDepsBeforeRuncheck now holds the workspace projects that the selected project depends on, includinglink:workspace dependencies.--filter=<project>...now selectslink:dependencies as well. WithsharedWorkspaceLockfile: false,verifyDepsBeforeRunalso reports dependencies as outdated when a selected project'spnpm-lock.yamlis missing pnpm/tasks#138. -
verifyDepsBeforeRunand repeatpnpm installruns now applyoverridesbefore comparing a modifiedpackage.jsonwithpnpm-lock.yaml#17127.verifyDepsBeforeRunalso checks whether each importer's resolved catalog versions match the catalog snapshot inpnpm-lock.yaml, and respectslockfileDirin single-project repositories. -
verifyDepsBeforeRunnow compares manifests, lockfiles, and patch files by content hash. It notices an edit that kept the file's modification time, ascp -p,rsync -a, or an archive extraction leave it, and a patch file that was copied or touched without changing its content no longer marks dependencies as outdated #16988.
Deploying and other commands
-
pnpm deploynow records the peer dependencies of the workspace packages it copies into the deployed lockfile. Before, pnpm rejected that lockfile with--frozen-lockfilewhen a deployed workspace package declared a peer andinjectWorkspacePackageswas off #17093. -
pnpm install --frozen-lockfileandverifyDepsBeforeRunnow succeed inside a directory created bypnpm deploy.pnpm deploywrites self-contained workspace and lockfile settings, prunes unusedpatchedDependencies, and preserves workspace-level dependency resolutions on deployed directory dependencies. -
In workspaces with
sharedWorkspaceLockfile: false,pnpm patch,pnpm patch-commit, andpnpm patch-removenow resolve patch files andpatchedDependenciesentries at the workspace root.pnpm installchecks configured patches across all workspace projects before reporting unused patches. -
Trusted publishing with OIDC now works with registries whose URL has a path, such as
https://registry.example/npm/private/. pnpm previously sent the token exchange request to the root of the registry host. -
pnpm owner lsnow lists the owners of a package on the npm registry. It reported every package as not found. -
pnpm sbomnow reads project lockfiles in workspaces withsharedWorkspaceLockfile: false, including filtered and split output, and reports the repository of a package whoserepositoryfield is agist:shorthand. -
pnpm licenses listreports no licenses for workspace projects not recorded in the lockfile. It errors whenpnpm-lock.yamlis missing. Empty results now use the requested text or JSON format pnpm/tasks#174. -
pnpm whynow reads each selected workspace project's lockfile and modules directory whensharedWorkspaceLockfileisfalsepnpm/tasks#169. -
pnpm pkg fixnow converts arepositorystring such asgithub:pnpm/exampleto the object form, asnpm pkg fixdoes. It also normalizes a GitHub, GitLab, or Bitbucket repository URL the waynpm pkg fixdoes #16980.
Configuration and setting up pnpm
-
pnpm now recognizes
externalDependenciesandautoInstallPeersFromHighestMatchinpnpm-workspace.yamlwithout warning and forwards both settings topnpm install. Previously, settingexternalDependenciesinpnpm-workspace.yamlwithnodeLinker: hoistedcrashedpnpm installwithexternalDependencies.has is not a functionpnpm/tasks#166. -
pnpm now ignores a
PNPM_CONFIG_*environment variable for a URL setting, such asPNPM_CONFIG_REGISTRY, when its value is not a URL. Such a value used to make every command fail withInvalid URL. -
The warning about unrecognized settings in
pnpm-workspace.yamland the globalconfig.yamlnow namesaddMissingPeerTypes,autoDedupe,bootConfig,macosBackup,nodePackageMap,permissions,pipelineBase,publishWaitTimeout,python,remoteCache,saveTypes,skills,storeIndexFormat, andtoolsas pnpm v12 settings pnpm/tasks#167. -
When a config file has a setting pnpm cannot read,
pnpm --versionnow prints the version, andpmOnFailandlockfileDirinpnpm-workspace.yamlstay in force. Previously, pnpm switched to the pinned version despitepmOnFail: ignore. pnpm also no longer writes the pinned version topnpm-lock.yamlwhen it cannot read every setting and the running pnpm already matches the pin. -
pnpm now records the pinned pnpm version in the
pnpm-lock.yamlunder thelockfileDirset inpnpm-workspace.yaml, and resolves a relativelockfileDirfrom the workspace root. pnpm used to write a secondpnpm-lock.yamlat the workspace root. -
pnpm self-updatenow updates the project's pnpm pin when Homebrew installed pnpm or Corepack runs it. The global pnpm is left alone #17001. -
pnpm setupnow completes when Windows registry environment values cannot be read or written. It prints PowerShell commands to configurePNPM_HOMEandPATHwithout registry access #17167. -
pnpm setupnow succeeds when it cannot tell which shell configuration file to update, for example in a container whereSHELLis not set. It installs pnpm and prints thePNPM_HOMEandPATHlines to add yourself. Previously it failed withERR_PNPM_UNKNOWN_SHELL, and so did the installer script at get.pnpm.io #16973.
<!-- sponsors -->
Platinum Sponsors
<table> <tbody> <tr> <td align="center" valign="middle"> <a href="https://bit.cloud/?utm_source=pnpm&utm_medium=release_notes" target="_blank" rel="noopener noreferrer"><img src="https://pnpm.io/img/users/bit.svg" width="80" alt="Bit"></a> </td> <td align="center" valign="middle"> <a href="https://openai.com/?utm_source=pnpm&utm_medium=release_notes" target="_blank" rel="noopener noreferrer"> <picture> <source media="(prefers-color-scheme: light)" srcset="https://pnpm.io/img/users/openai_dark.svg" /> <source media="(prefers-color-scheme: dark)" srcset="https://pnpm.io/img/users/openai_light.svg" /> <img src="https://pnpm.io/img/users/openai_dark.svg" width="160" alt="OpenAI" /> </picture> </a> </td> <td align="center" valign="middle"> <a href="https://notion.com/?utm_source=pnpm&utm_medium=release_notes" target="_blank" rel="noopener noreferrer"><img src="https://pnpm.io/img/users/notion.svg" width="80" alt="Notion"></a> </td> </tr> <tr> <td align="center" valign="middle"> <a href="https://coderabbit.ai/?utm_source=pnpm&utm_medium=release_notes" target="_blank" rel="noopener noreferrer"> <picture> <source media="(prefers-color-scheme: light)" srcset="https://pnpm.io/img/users/coderabbit.svg" /> <source media="(prefers-color-scheme: dark)" srcset="https://pnpm.io/img/users/coderabbit_light.svg" /> <img src="https://pnpm.io/img/users/coderabbit.svg" width="220" alt="CodeRabbit" /> </picture> </a> </td> </tr> </tbody> </table>
Gold Sponsors
<table> <tbody> <tr> <td align="center" valign="middle"> <a href="https://sanity.io/?utm_source=pnpm&utm_medium=release_notes" target="_blank" rel="noopener noreferrer"> <picture> <source media="(prefers-color-scheme: light)" srcset="https://pnpm.io/img/users/sanity.svg" /> <source media="(prefers-color-scheme: dark)" srcset="https://pnpm.io/img/users/sanity_light.svg" /> <img src="https://pnpm.io/img/users/sanity.svg" width="120" alt="Sanity" /> </picture> </a> </td> <td align="center" valign="middle"> <a href="https://discord.com/?utm_source=pnpm&utm_medium=release_notes" target="_blank" rel="noopener noreferrer"> <picture> <source media="(prefers-color-scheme: light)" srcset="https://pnpm.io/img/users/discord.svg" /> <source media="(prefers-color-scheme: dark)" srcset="https://pnpm.io/img/users/discord_light.svg" /> <img src="https://pnpm.io/img/users/discord.svg" width="220" alt="Discord" /> </picture> </a> </td> <td align="center" valign="middle"> <a href="https://vite.dev/?utm_source=pnpm&utm_medium=release_notes" target="_blank" rel="noopener noreferrer"><img src="https://pnpm.io/img/users/vitejs.svg" width="42" alt="Vite"></a> </td> </tr> <tr> <td align="center" valign="middle"> <a href="https://serpapi.com/?utm_source=pnpm&utm_medium=release_notes" target="_blank" rel="noopener noreferrer"> <picture> <source media="(prefers-color-scheme: light)" srcset="https://pnpm.io/img/users/serpapi_dark.svg" /> <source media="(prefers-color-scheme: dark)" srcset="https://pnpm.io/img/users/serpapi_light.svg" /> <img src="https://pnpm.io/img/users/serpapi_dark.svg" width="160" alt="SerpApi" /> </picture> </a> </td> <td align="center" valign="middle"> <a href="https://stackblitz.com/?utm_source=pnpm&utm_medium=release_notes" target="_blank" rel="noopener noreferrer"> <picture> <source media="(prefers-color-scheme: light)" srcset="https://pnpm.io/img/users/stackblitz.svg" /> <source media="(prefers-color-scheme: dark)" srcset="https://pnpm.io/img/users/stackblitz_light.svg" /> <img src="https://pnpm.io/img/users/stackblitz.svg" width="190" alt="Stackblitz" /> </picture> </a> </td> <td align="center" valign="middle"> <a href="https://workleap.com/?utm_source=pnpm&utm_medium=release_notes" target="_blank" rel="noopener noreferrer"> <picture> <source media="(prefers-color-scheme: light)" srcset="https://pnpm.io/img/users/workleap.svg" /> <source media="(prefers-color-scheme: dark)" srcset="https://pnpm.io/img/users/workleap_light.svg" /> <img src="https://pnpm.io/img/users/workleap.svg" width="190" alt="Workleap" /> </picture> </a> </td> </tr> <tr> <td align="center" valign="middle"> <a href="https://nx.dev/?utm_source=pnpm&utm_medium=release_notes" target="_blank" rel="noopener noreferrer"> <picture> <source media="(prefers-color-scheme: light)" srcset="https://pnpm.io/img/users/nx.svg" /> <source media="(prefers-color-scheme: dark)" srcset="https://pnpm.io/img/users/nx_light.svg" /> <img src="https://pnpm.io/img/users/nx.svg" width="50" alt="Nx" /> </picture> </a> </td> <td align="center" valign="middle"> <a href="https://latitude.so/?utm_source=pnpm&utm_medium=release_notes" target="_blank" rel="noopener noreferrer"><img src="https://pnpm.io/img/users/latitude.svg" width="160" alt="Latitude"></a> </td> </tr> </tbody> </table>
<!-- sponsors end -->