Skip to content

Regression in pnpm 10.29.3 with Electron packaging (transitive dependency missing at runtime) #10601

Closed

Description

@tom5park

Last pnpm version that worked

10.29.2

pnpm version

10.29.3

Code to reproduce the issue

  1. Use pnpm 10.29.2 on macOS with an Electron + electron-builder project.
  2. Run: pnpm install --frozen-lockfile
  3. Run: pnpm run build && pnpm exec electron-builder --mac mas-dev
  4. Inspect app.asar: node_modules/ms is present.

Then upgrade only pnpm to 10.29.3 and run the same commands.
Result: app launches with runtime error Cannot find module 'ms' (require stack includes debug/src/common.js), and app.asar contains node_modules/debug but not node_modules/ms.

Expected behavior

Patch upgrade from pnpm 10.29.2 to 10.29.3 should not change packaged runtime dependency completeness. Required transitive dependencies (such as ms) should remain present in app.asar.

Actual behavior

With pnpm 10.29.3, packaged Electron app crashes at runtime with Cannot find module 'ms' from debug/src/common.js. In app.asar, node_modules/debug exists but node_modules/ms is missing. Downgrading to pnpm 10.29.2 restores normal behavior.

Additional information

Environment (anonymized):

  • macOS (Apple Silicon)
  • Homebrew-installed pnpm
  • Node.js v25.6.1
  • Electron + electron-builder (MAS target)

This appears to be a regression between pnpm 10.29.2 and 10.29.3 for this packaging workflow.

Node.js version

v25.6.1

Operating System

macOS

Activity

  1. zkochan commented on Feb 13, 2026

    @zkochan
    Member

    I don't see any changes in v10.29.3 that could cause such an issue: https://github.com/pnpm/pnpm/releases/tag/v10.29.3

    do you have a repo that reproduces the issue? I don't know how to create an electron project.

  2. dex4er commented on Feb 13, 2026

    @dex4er

    @zkochan You can check this PR: freelensapp/freelens#1637

    With pnpm 10.29.2 all is fine. After the upgrade the application breaks with mysterious errors like Error: Cannot find module '@so-ric/colorspace': https://github.com/freelensapp/freelens/actions/runs/21960356282/job/63435818307?pr=1637#step:34:38

    Steps to reproduce it after git clone of this repo:

    gh pr checkout 1637
    pnpm i
    pnpm build
    pnpm build:app:dir
    pnpm start
    

    Result: crashes in the main process (Chrome browser)

  3. Anonymous327 commented on Feb 13, 2026

    @Anonymous327

    Having the same issue here. It's weird. Builds just fine with any version below 10.29.3, but "missing modules" with the latest version.

  4. MoeFurina commented on Feb 14, 2026

    @MoeFurina

    The same issue occurred in the project build of imsyy/splayer

  5. mmaietta commented on Feb 20, 2026

    @mmaietta

    Could this be related?
    https://github.com/pnpm/pnpm/pull/10586/changes#diff-f2c67b6ce1dd4f075157bf06c2eb506a6b2fb31d1eff02097f2abf41d9e711d0

    Electron-builder runs pnpm ls --json --depth Infinity --prod to walk the full dependency tree before pulling packages to copy into the app bundle. It parses the JSON output recursively to collect every package's real filesystem path, then copies those directories into the final build artifact.
    https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/src/node-module-collector/pnpmNodeModulesCollector.ts

    From what I understand, pnpm ls --json previously emitted the complete subtree for every occurrence of a package (with circular detection as the only deduplication); it now emits a truncated node for subsequent occurrences. In JSON output, a deduplicated node is elided.

    {
      "alias": "ajv",
      "version": "8.17.1",
      "path": "/path/to/.pnpm/[email protected]/...",
      "deduped": true,
      "dedupedDependenciesCount": 5
    }

    Electron-builder's dependency collector was written assuming that pnpm ls --json --depth Infinity always fully expands every node in the tree. Its recursive walker visits the dependencies map of each node to collect all packages' real paths.

    What is needed from the electron-builder side to resolve this? 🙂 Looks like it was an OOM fix, so maybe there are some changes I can make on my side to balance this out? Let me know.

  6. zkochan commented on Feb 20, 2026

    @zkochan
    Member

    Thanks @mmaietta for looking into it. It would be best to change electron-builder. We can't really go back to the old format as the list command was broken, slow, and failed with OOM on bigger projects. If electron-builder needs some additional data to reconstruct the full graph or if we can improve the json format otherwise, I am open to such improvements. But we can't just go back to duplication.

  7. mmaietta commented on Feb 20, 2026

    @mmaietta

    Yep, fully aligned there. Let me see what I can come back with and will reach out if I need additional data/insight.

  8. yanglee2421 commented on Feb 27, 2026

    @yanglee2421

    Same issue here, Go back to pnpm@9 to resume work

  9. Molunerfinn commented on Mar 6, 2026

    @Molunerfinn

    Same issue here. 10.29.2 works

  10. added a commit that references this issue on Mar 8, 2026
  11. Anonymous327 commented on Mar 11, 2026

    @Anonymous327

    Has this been fixed yet?

  12. mmaietta commented on Mar 11, 2026

    @mmaietta

    It's fixed in next electron-builder release 26.8.2.

    I think this issue can be closed since pnpm is not reverting the breaking API-response change and a fix has been patched released in electron-builder.

  13. faithmckinely-alt commented on Mar 12, 2026

    @faithmckinely-alt
  14. thedogecraft commented on Apr 1, 2026

    @thedogecraft

    Thanks.

  15. added a commit that references this issue on Apr 1, 2026
  16. zkochan commented on Sep 19, 2026

    @zkochan
    Member

    This does not reproduce on current pnpm, so closing.

    Verified on pnpm 12.5.1: a dependency's own transitive dependency is present next to it, both in the isolated layout and with nodeLinker: hoisted, and resolves from it.

    If you still hit this on the latest pnpm, please comment with a reproduction and we will reopen.


    Written by an agent (Claude Code, claude-opus-5).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions