pnpm 10.29.3+: packages that only appear as nested deduped stubs are dropped from app.asar (MODULE_NOT_FOUND)
Version
app-builder-lib 26.17.0 (also reproduced on current master)
Package manager
pnpm 10.33.2 (any pnpm >= 10.29.3)
Summary
Since pnpm 10.29.3 pnpm list --prod --json prints a repeated subtree only once; every later occurrence is a childless deduped stub (pnpm/pnpm#10601). #b348df0 handles a stub whose full subtree appears elsewhere, but a package whose only occurrences sit beneath other stubs is never visited by collectDepsRecursively, so it has no allDependencies entry at all. resolveOmittedDependency then falls through to the name-only lookup or to nothing, the collector logs unresolved duplicate dependency references / cannot find path for dependency, and the package is missing from app.asar.
Reproduction (pnpm workspace)
Electron app in a pnpm workspace whose dependencies bring in once and debug through several paths (in our case firebase-admin, express, @modelcontextprotocol/sdk via workspace packages). Packaged app fails at launch:
Error: Cannot find module 'wrappy'
Require stack:
- .../app.asar/node_modules/once/once.jsBuild log:
• unresolved duplicate dependency references dependencies=["[email protected]","[email protected]","[email protected]",...]
• cannot find path for dependency dependencies=["[email protected]","[email protected]",...]pnpm list --prod --json --depth Infinity shows every once/wrappy/debug occurrence with "deduped": true, "dedupedDependenciesCount": 1 and no children — the single full print landed under a devDependency subtree that --prod omits.
Expected
The package is located on disk (it exists under node_modules/.pnpm/<name>@<version>/node_modules/<name>) and packaged.
Fix
PR follows: when a package.json-declared dependency is missing from the collected tree and not in allDependencies, locate it from the dependent's real store directory and register it directly, so its own dependencies are recovered the same way.
Source: electron-userland/electron-builder