[Bug?]: yarn run may fail on missing unrelated dependencies with pnp linker
Author: cdcxdCreated Aug 22, 2026Updated Aug 22, 2026
Labelsbug
Self-service
- I'd be willing to implement a fix
Describe the bug
The issue was yarn run / yarn bin / yarn node under pnp linker would resolve every packages without a valid install-state.gz . If the pnp map covers what it needs, but not all packages, it will throw. The message is usually couldn't find an unrelated package.
Why I think it's a fix
- #2043 decided a dependency the linker can't place shouldn't block usable binaries.
- The printed error is a bit misleading, because command never needs that package. It's like
Couldn't find eslint@npm:8.57.1 in the currently installed PnP map, but eslint isn't requested by user. - It's fine with node modules linker.
- It's consistent with yarn v6 behavior, only locate the binary it needs. I was referring to: https://github.com/yarnpkg/zpm/blob/def394488933b0c5037e70d82a2f4842089497e4/packages/zpm/src/project.rs#L1352
To reproduce
Minimal Reproduce
.gitignore
# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
package.json
{
"name": "reproduce",
"version": "1.0.0",
"scripts": {
"start": "next start"
},
"dependencies": {
"next": "14.2.15",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"devDependencies": {
"eslint": "8.57.1",
"eslint-config-next": "14.2.15"
}
}
Manually remove install-state.gz
yarn install
yarn workspaces focus reproduce --production
rm .yarn/install-state.gz # Mimic a remote/hermetic build that install-state doesn't transfer
yarn run start # throws on couldn't find eslint , where eslint isn't requiredOr commit a workspace-focus pnp for reproducing
git init
yarn install
yarn workspaces focus reproduce --production
git add -A && git commit -m "zero-install" # commits the focused .pnp.cjs
cd .. && git clone repo fresh
cd fresh && yarn run start # throws on eslintEnvironment
System:
OS: Linux 7.0 Ubuntu 24.04.4 LTS 24.04.4 LTS (Noble Numbat)
CPU: (24) x64 AMD Ryzen 9 3900X 12-Core Processor
Binaries:
Node: 18.19.1 - /tmp/xfs-779db9e0/node
Yarn: 4.18.0-dev - /tmp/xfs-779db9e0/yarn
npm: 9.2.0 - /usr/bin/npmSource: yarnpkg/berry