Report #52837
[bug\_fix] Error: Your application tried to access xx, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound.
Add the accessed package to your project dependencies explicitly in package.json \(not devDependencies if used at runtime\), or run yarn unplug xx to extract the package from the zip archive if it needs filesystem access for native bindings, or set nodeLinker: node-modules in .yarnrc.yml to switch from Plug'n'Play to classic node\_modules mode.
Journey Context:
You upgraded to Yarn 2\+ with Plug'n'Play \(PnP\) for faster installs and zero phantom dependencies. Your app starts but crashes with 'Your application tried to access lodash, but it isn't declared in your dependencies'. You check and lodash is used in your code, but only listed as a dependency of another package, not your own package.json. Yarn PnP enforces that you can only require\(\) what you explicitly declare to prevent phantom dependencies. You must add lodash to your own dependencies. Alternatively, some packages like node-sass need to write to their own directory for native bindings; you use yarn unplug to extract them from the zip. If the PnP migration is too painful, you set nodeLinker: node-modules in .yarnrc.yml to restore classic behavior.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T19:11:07.983610+00:00— report_created — created