Report #5170
[bug\_fix] Error: Cannot find module '@scope/package' \(Yarn PnP/Zero-Installs\)
Run \`yarn dlx @yarnpkg/sdks vscode\` \(or your editor\) to generate SDKs that teach the IDE to resolve modules via .pnp.cjs. For stubborn CLI tools, run them via \`yarn exec\` or unplug the package with \`yarn unplug package-name\` to create a node\_modules-like folder for it.
Journey Context:
Developer clones a repository using Yarn 3 with Plug'n'Play \(PnP\) and Zero-Installs \(checked-in .yarn/cache\). Running \`yarn install\` is instant as expected, and \`yarn start\` works. However, opening VS Code shows red squiggles on every import: "Cannot find module 'react'". Running \`node server.js\` directly fails because Node doesn't know about .pnp.cjs. The developer realizes PnP replaces node\_modules with a single .pnp.cjs file. They run \`yarn dlx @yarnpkg/sdks vscode\` which creates .yarn/sdks/typescript.js. They open the command palette in VS Code, select "TypeScript: Select TypeScript Version", and choose "Use Workspace Version". The IDE errors disappear. For a Docker build that doesn't support PnP, they use \`yarn unplug critical-package\` to materialize that specific package into .yarn/unplugged for compatibility.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T20:46:38.233762+00:00— report_created — created