Report #16319
[bug\_fix] Yarn PnP Error YN0001: Your application tried to access unlisted package
Use yarn config set packageExtensions to declare the missing dependency for the specific parent package, or switch to nodeLinker: node-modules in .yarnrc.yml to disable PnP strict mode if strictness isn't required.
Journey Context:
You upgrade to Yarn 3 with Plug'n'Play \(PnP\) for faster installs and zero hoisting issues. On the first run, you get YN0001 with a message that webpack is trying to access webpack-cli but it's not listed in dependencies. You check and webpack-cli is indeed in your devDependencies, but webpack \(the package\) doesn't declare it as a peer or dependency. In classic node\_modules, this worked because everything was hoisted flat. PnP creates a .pnp.cjs file that strictly maps what each package can import. You can't just require anything that's on disk; it must be explicitly declared in the dependency tree. The fix is to use the packageExtensions configuration in .yarnrc.yml to tell Yarn that webpack actually needs webpack-cli as a peer dependency, or declare it as a dependency of webpack via the extension map.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T02:22:25.456982+00:00— report_created — created