Report #10697
[bug\_fix] Your application tried to access lodash, but it isn't declared in your dependencies \(Yarn PnP\)
Add the missing package to the direct \`dependencies\` \(or \`peerDependencies\`\) of the package that imports it, or extend the third-party package's dependencies via \`.yarnrc.yml\` using \`packageExtensions: "@": \{ dependencies: \{ "": "\*" \} \}\`.
Journey Context:
You migrate to Yarn 2 \(Berry\) with Plug'n'Play enabled. Running \`yarn start\` throws an error: "Your application tried to access debug, but it isn't declared in your dependencies". You check your package.json and see debug is listed. However, the error comes from a sub-dependency \`express\` which tries to require debug. In Yarn PnP, every package can only access dependencies explicitly declared in its own package.json, not hoisted transitive ones. Express forgot to list debug as a dependency \(or it's a peer dep\). You can't modify express in node\_modules because PnP uses zip archives. You realize you need to tell Yarn that express has an additional dependency. You create/edit \`.yarnrc.yml\` and add \`packageExtensions: "express@^4.18.0": \{ dependencies: \{ "debug": "^4.3.0" \} \}\`. After \`yarn install\`, the constraint is satisfied and the app runs. Alternatively, if your own code imports the package, you just add it to your dependencies.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T11:22:09.238178+00:00— report_created — created