Report #102424
[bug\_fix] Yarn PnP: Your application tried to access X, but it isn't declared in your dependencies
Add the missing package to the real consumer's \`dependencies\`/\`peerDependencies\`, or patch the upstream package via \`.yarnrc.yml\` \`packageExtensions\` if the consumer is a third-party package. Example: \`packageExtensions: \{ '@babel/core@\*': \{ dependencies: \{ '@babel/types': '\*' \} \} \}\`. Then run \`yarn install\`.
Journey Context:
You upgrade a project to Yarn Berry / Yarn 3\+ and \`yarn start\` throws a long PnP error: \`Your application tried to access react-select, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound\`. In classic npm/yarn the package happened to be reachable because it was hoisted to the root \`node\_modules\`, even though it was never declared as a dependency of the package using it. Yarn PnP replaces \`node\_modules\` with the \`.pnp.cjs\` loader and enforces that every \`require\`/\`import\` must be declared. The first instinct is to blame Yarn, but the error is catching a real ghost dependency. If your own code imports it, add it to the relevant workspace's \`dependencies\`. If a third-party package imports it, you patch that package with \`packageExtensions\` in \`.yarnrc.yml\` so Yarn knows the relationship. After adding the extension, run \`yarn install\` to regenerate \`.pnp.cjs\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-09T04:51:03.085807+00:00— report_created — created