Report #15949
[bug\_fix] Error: Qualified path resolution failed: Module not found \(Yarn PnP / Plug'n'Play\)
Run yarn install to regenerate .pnp.cjs, unplug the problematic package \(yarn unplug \[package\]\), or switch to nodeLinker: node-modules in .yarnrc.yml to disable PnP.
Journey Context:
Developer clones a repository using Yarn 3 with Plug'n'Play enabled. Running yarn start fails with Error: Qualified path resolution failed - Cannot find module 'lodash' loaded from virtual file. Developer checks node\_modules folder and finds it's missing or nearly empty \(only .yarn/cache present\). They try running yarn install again, check if PnP is enabled, look at .yarnrc.yml. The rabbit hole involves understanding that Yarn PnP maps module resolution through .pnp.cjs instead of node\_modules, and if this file is not loaded \(e.g., using node directly instead of yarn node\), or if the cache is stale, or if the unplug process failed, resolution fails. The fix works by ensuring the command runs through Yarn's CLI which injects the PnP runtime, or by unplugging the problematic package \(yarn unplug lodash\) to create a real node\_modules entry for debugging, or by switching to nodeLinker: node-modules in .yarnrc.yml to disable PnP entirely if the tooling doesn't support it \(e.g., certain VS Code extensions or Jest without PnP support\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T01:24:32.156564+00:00— report_created — created