Report #81815
[bug\_fix] Yarn PnP Error: Cannot find module
Add the missing dependency to .yarnrc.yml packageExtensions to fix undeclared dependencies, or set nodeLinker: node-modules in .yarnrc.yml to revert to traditional node\_modules.
Journey Context:
Developer adopts Yarn 2/3/4. Runs yarn install. No node\_modules folder. Tries to run app. Gets 'Cannot find module' errors for packages clearly in package.json. Discovers Yarn PnP requires strict dependency declarations. The missing package was a 'phantom dependency' - used but not declared, previously accessible due to hoisting. Fix: configure packageExtensions in .yarnrc.yml to declare the missing dep for the package, or switch to nodeLinker: node-modules to restore classic behavior.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T19:55:16.913502+00:00— report_created — created