Skip to content

[Bug]: Desktop app crashes on launch — Cannot find module 'simple-git' (git-review IPC dep not bundled) #52735

Description

@kroehrs

What happened

After an in-app desktop update to current main, the Hermes desktop app fails to launch with a fatal uncaught exception:

Uncaught Exception:
Error: Cannot find module 'simple-git'
Require stack:
- .../Hermes.app/Contents/Resources/app.asar/electron/git-review-ops.cjs
- .../Hermes.app/Contents/Resources/app.asar/electron/main.cjs
    at Module._resolveFilename (node:internal/modules/cjs/loader:1483:15)
    ...
    at require (node:internal/modules/helpers:153:16)

electron/main.cjs require()s electron/git-review-ops.cjs at module load, and that file does require('simple-git') at the top level, so the missing module is fatal at startup — the app never comes up.

Root cause

simple-git (added with the git worktree/review IPC feature) is declared in apps/desktop/package.json, but npm workspace dedup hoists it into the repo-root node_modules, out of reach of electron-builder's file collector:

  • build.files in apps/desktop/package.json is an explicit allow-list (dist, assets, electron, public, package.json) — the packaged app.asar ships no node_modules at all.
  • The only runtime dep currently bundled is node-pty, hand-staged by scripts/stage-native-deps.cjs + a process.resourcesPath fallback in main.cjs. simple-git got no equivalent staging and no fallback, so it ships nowhere.

ElectronAsarIntegrity (Info.plist) pins a SHA256 of app.asar, so patching the bundle in place is not viable — the dependency has to be staged at build time.

Steps to reproduce

  1. Build/package the desktop app from current main (e.g. via the in-app update / hermes desktop --build-only).
  2. Launch the packaged Hermes.app.
  3. App dies immediately with Cannot find module 'simple-git'.

Environment

  • Hermes desktop main (reproduced at commit 208f0d7c3)
  • macOS arm64 (packaging path is platform-independent — same hoisting issue on Windows/Linux)

Suggested fix

Mirror the existing node-pty handling: have scripts/stage-native-deps.cjs resolve simple-git's full dependency closure and stage it into build/native-deps/node_modules/ (shipped via the existing extraResources entry), and add a process.resourcesPath require fallback in git-review-ops.cjs. PR incoming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/desktopElectron desktop app (apps/desktop/*)sweeper:risk-compatibilitySweeper risk: may break existing users, config, migrations, defaults, or upgradestype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions