Skip to content

fix(pnp): skip uninstalled unrelated packages when looking up binaries - #7265

Open
cdcxd wants to merge 3 commits into
yarnpkg:masterfrom
cdcxd:yarn_bin_pnp_dont_resolve_everything
Open

fix(pnp): skip uninstalled unrelated packages when looking up binaries#7265
cdcxd wants to merge 3 commits into
yarnpkg:masterfrom
cdcxd:yarn_bin_pnp_dont_resolve_everything

Conversation

@cdcxd

@cdcxd cdcxd commented Aug 22, 2026

Copy link
Copy Markdown

What's the problem this PR addresses?

Closes #7264

...

How did you fix it?

I made pnp linker follow the same thing done for node modules linker:

(err as any).code = `LOCATOR_NOT_INSTALLED`;

That signal the package can't be located and allows it to skip (already in
return miscUtils.mapAndFilter.skip;
).

Also added a unit test to guard this behavior.

No PR for yarn v6. This problem doesn't exist in yarn v6, it has solved the problem structurally https://github.com/yarnpkg/zpm/blob/def394488933b0c5037e70d82a2f4842089497e4/packages/zpm/src/project.rs#L1352
...

Verification

I'm testing it using the example in #7264 , that we start a devserver and the error is on the unrelated eslint.

command PnP — before PnP — after node-modules (unaffected)
yarn run start Couldn't find eslint@npm:8.57.1 in the currently installed PnP map ✓ boots Next.js ✓ boots Next.js
yarn next --version same as above Next.js v14.2.15 Next.js v14.2.15
yarn bin next same as above ✓ prints the next bin path ✓ prints the path
yarn bin (list) same as above ✓ lists next ✓ lists next
yarn node -e "require.resolve('next')" same as above ✓ resolves ✓ resolves
yarn eslint --version same as above Couldn't find a script named "eslint" same as left
yarn node -e "require.resolve('eslint')" same as above …tried to access eslint, but it isn't declared… same as left

Checklist

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug?]: yarn run may fail on missing unrelated dependencies with pnp linker

1 participant