Report #64546
[bug\_fix] Error: Your application tried to access , but it isn't declared in your dependencies... \(PnpError\)
Add the missing dependency to the specific package's package.json \(zero-installs principle\). Or use \`packageExtensions\` in \`.yarnrc.yml\` to patch dependencies that forgot to declare their deps. Or run \`yarn unplug \` if the package needs node\_modules access. Alternatively, switch to node\_modules mode via \`nodeLinker: node-modules\` in \`.yarnrc.yml\`.
Journey Context:
Developer migrates to Yarn Berry \(v2/v3/v4\), enables PnP. Runs \`yarn install\`, no node\_modules created. Runs \`yarn start\`, gets PnpError saying a package tries to access 'lodash' but it isn't declared in dependencies. Realizes that unlike node\_modules hoisting, PnP enforces that packages can only access their explicit dependencies. Uses \`yarn why lodash\` to trace the issue. Adds the missing dependency via \`packageExtensions\` in \`.yarnrc.yml\` to patch the offending package, or adds it to the root if it's the app's fault. Alternatively, switches to \`nodeLinker: node-modules\` to disable PnP entirely.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T14:49:43.753043+00:00— report_created — created