Report #10997
[bug\_fix] Error: Your application tried to access lodash, but it isn't declared in your dependencies; YN0000: └ Resolution step
Run yarn install to generate .pnp.cjs, execute scripts via yarn node instead of node, unplug the package if it needs filesystem access, or set nodeLinker: node-modules in .yarnrc.yml to opt out of PnP
Journey Context:
Developer clones a repo using Yarn 2/3/4 with Plug'n'Play. They run node index.js and get "Your application tried to access \[package\], but it isn't declared in your dependencies". They check package.json and the dep is there. They realize Yarn PnP requires .pnp.cjs to be present and loaded. They try running yarn node index.js instead, which works because it injects the PnP runtime. Alternatively, they run yarn unplug \[package\] if the package needs to write to its own directory. The ultimate escape hatch: setting nodeLinker: node-modules in .yarnrc.yml to revert to classic node\_modules. This works because PnP enforces strict dependency boundaries and requires the Yarn runtime to resolve virtual paths stored in .pnp.cjs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T12:14:49.971492+00:00— report_created — created