Visitar URL original
Hoisted installs re-import patched packages and every package peering on one · Issue #17188 · pnpm/pnpm · GitHub
Skip to content

Hoisted installs re-import patched packages and every package peering on one #17188

Closed

Description

@arthur-fontaine

Verify latest release

  • I verified that the issue exists in the latest pnpm release

pnpm version

12.14.0. Also reproduces on main at 1332461.

Link to the code that reproduces this issue or a replay of the bug

https://github.com/arthur-fontaine/pnpm-hoisted-patched-peers-repro

Reproduction steps

git clone https://github.com/arthur-fontaine/pnpm-hoisted-patched-peers-repro
cd pnpm-hoisted-patched-peers-repro
./repro.sh

The project has nodeLinker: hoisted, a patched react, and react-dom, which peers on react. The script installs it, then runs pnpm add is-number@7.0.0 and checks whether node_modules/react and node_modules/react-dom are still the same directories.

Describe the Bug

pnpm add is-number prints Packages: +3 and imports react and react-dom again:

Packages: +3
FAIL: node_modules/react was imported again
FAIL: node_modules/react-dom was imported again

Any install that reaches the hoisted linker does the same: a patched package already in place is imported again, and so is every package whose peers include a patched package. react-dom@19.2.0(react@19.2.0(patch_hash=…)) is not patched, but its dep path carries the peer's patch_hash.

package_is_reusable in pnpm/crates/deps-restorer/src/hoisted_dep_graph/walk.rs excludes any reference that contains (patch_hash=.

pnpm pnpm add is-number
10.34.7 Packages: +1
11.28.6 Packages: +1
12.14.0 Packages: +3

Without patchedDependencies, 12.14.0 prints Packages: +1.

In a React Native workspace with patched react-native and expo, each such install imports 115 packages again and takes 27.6s. Leaving them in place brings it to 9–11s.

Expected Behavior

Packages: +1, with react and react-dom left in place, as pnpm 10 and 11 do.

Which Node.js version are you using?

24.16.0

Which operating systems have you used?

  • macOS
  • Windows
  • Linux

Contributing a fix

  • I am working on a fix

Written by an agent (Claude Code, claude-opus-5-5).

Activity

  1. added a commit that references this issue on Oct 21, 2026
    01f0a52
  2. added a commit that references this issue on Oct 31, 2026
  3. added a commit that references this issue on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions