Skip to content

[Bug] bun run dev cannot launch Electron inside a git worktree — dist binary is a 244K stub (vs 274M in main checkout) #1329

@Astro-Han

Description

@Astro-Han

What happened?

Running bun run dev (which calls electron-vite dev) inside a git worktree (.claude/worktrees/<name>) never launches Electron. predev (icons, remote-bridge, embedded server) and all three electron-vite build phases (main / preload / renderer) finish successfully, but the final "start Electron" step fails.

The root cause is that the Electron binary in the worktree is a stub: node_modules/.bun/electron@40.8.0/node_modules/electron/dist is only 244K (just Contents/MacOS/ + Contents/Resources/), whereas the same version in the main checkout is a complete 274M (includes Contents/Frameworks/Electron Framework.framework and friends). In other words, bun install inside the worktree did not run Electron's binary-download postinstall, leaving an empty shell.

Depending on how incomplete the install is, this surfaces as a few different errors (same underlying cause):

  1. Missing path.txt → electron-vite's getElectronPath throws Error: Electron uninstall.
  2. Missing Contents/Frameworks/ → the process starts but dyld fails: Library not loaded: @rpath/Electron Framework.framework/Electron Framework.
  3. (Intermittent, separate) build phase crashes in esbuild: fatal error: all goroutines are asleep - deadlock! — a retry gets past it; likely related to the large (~19.5MB) embedded-server chunk, not the main cause.

Which area seems affected?

Platform shell, packaging, updater, signing, paths, or permissions

How much does this affect you?

Blocks me from using PawWork (cannot run dev in a worktree at all without a manual fix)

Steps to reproduce

  1. Create a git worktree (e.g. git worktree add .claude/worktrees/foo).
  2. Inside the worktree, run bun install.
  3. Run bun run dev (= electron-vite dev).
  4. All three build phases succeed, then Electron fails to launch: Error: Electron uninstall, or dyld: Library not loaded: @rpath/Electron Framework.framework.

What did you expect to happen?

bun run dev inside a worktree should launch the Electron window just like it does in the main checkout. The worktree install should produce a complete Electron binary (Frameworks + path.txt), or reuse/share the already-downloaded dist from the main checkout.

PawWork version

Branch claude/i1188-remote (based on codex/i1188-remote-gateway); electron 40.8.0, electron-vite 5.0.0, bun 1.3.14

OS version

macOS 26.5 (arm64 / Apple Silicon)

Can you reproduce it again?

Yes, every time (every new worktree)

Diagnostics

Evidence:

# worktree (stub)
$ du -sh node_modules/.bun/electron@40.8.0/node_modules/electron/dist
244K   .../electron/dist
$ ls .../electron/dist/Electron.app/Contents/
MacOS  Resources                 # no Frameworks/, no path.txt

# main checkout (complete)
$ du -sh /Users/yuhan/workspace/dev/pawwork/node_modules/.bun/electron@40.8.0/node_modules/electron/dist
274M   .../electron/dist
$ ls .../electron/dist/Electron.app/Contents/Frameworks/
Electron Framework.framework  Electron Helper.app  Mantle.framework  Squirrel.framework  ...

Key log lines (/tmp/electron-dev.log):

# First run: missing path.txt
error during start dev server and electron app:
Error: Electron uninstall
    at getElectronPath (.../electron-vite/dist/chunks/lib-q6ns0vZr.js:155:19)

# After adding path.txt: missing Frameworks
starting electron app...
dyld[71941]: Library not loaded: @rpath/Electron Framework.framework/Electron Framework
  Referenced from: .../electron/dist/Electron.app/Contents/MacOS/Electron
  Reason: tried: '.../Contents/Frameworks/Electron Framework.framework/Electron Framework' (no such file)

# Separate intermittent crash (build phase, passes on retry):
fatal error: all goroutines are asleep - deadlock!   # esbuild

Possible directions / temporary workarounds (to be confirmed):

  • The worktree bun install does not trigger Electron's binary-download postinstall (electron is listed in trustedDependencies, but the worktree install seems to skip it).
  • Workaround: export ELECTRON_OVERRIDE_DIST_PATH=<main>/node_modules/.bun/electron@40.8.0/node_modules/electron/dist; or copy/symlink the complete dist from the main checkout into the worktree; or re-run Electron's install.js inside the worktree.
  • Longer-term: make worktree installs reliably reuse the already-downloaded Electron binary from the main checkout (shared cache / symlinked dist), instead of each worktree re-downloading 274M and possibly failing to complete.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions