Report #76722
[bug\_fix] Your application tried to access lodash, but it isn't declared in your dependencies \(Yarn PnP\)
Add the missing package to explicit dependencies, or add packageExtensions to .yarnrc.yml to declare transitive dependencies, or switch pnpMode to loose.
Journey Context:
Developer migrates to Yarn 2/3 with Plug'n'Play \(PnP\) strict mode. Running the app throws "Your application tried to access lodash, but it isn't declared in your dependencies - see .../.pnp.cjs". Debugging reveals that while the code imports lodash, it's not listed in package.json dependencies \(it was previously available as a transitive dependency via node\_modules hoisting\). Yarn PnP enforces strict dependency boundaries. The developer checks .yarnrc.yml and either adds lodash to explicit dependencies, or uses packageExtensions to patch the upstream package that should have declared lodash as a peer/dependency. Alternatively, setting pnpMode: loose in .yarnrc.yml restores some node\_modules-like tolerance.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T11:22:02.769304+00:00— report_created — created