Skip to content

fix(ci): node-pty crash on Intel Macs in universal build#301

Merged
parsakhaz merged 1 commit into
dcouple:mainfrom
jonatankruszewski:300-node-pty-crash
Jul 6, 2026
Merged

fix(ci): node-pty crash on Intel Macs in universal build#301
parsakhaz merged 1 commit into
dcouple:mainfrom
jonatankruszewski:300-node-pty-crash

Conversation

@jonatankruszewski

@jonatankruszewski jonatankruszewski commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #300

Problem

On Intel Macs, the packaged universal app crashes immediately at launch with:

Error: The @lydell/node-pty package supports your platform (darwin-x64), but
it could not find the platform-specific package for it:
@lydell/node-pty-darwin-x64

Root cause

GitHub's macos-latest runner is arm64, so pnpm install only materializes the optional dependency for the build machine's own arch — @lydell/node-pty-darwin-arm64. The --universal build then ships a node-pty loader that, when run on an Intel Mac (the x64 slice), looks for @lydell/node-pty-darwin-x64, which was never downloaded → fatal error in the main process on the first require.

Fix

Add supportedArchitectures to pnpm-workspace.yaml so pnpm materializes the optional platform binaries for every OS/CPU we ship, not just the build machine's own.

  • The lockfile already lists all six platform packages, so this does not change the lockfile — it only changes what gets installed on each build machine. CI's frozen install stays green.
  • electron-builder still prunes binaries that don't match the target platform, so the only net effect on the mac artifact is that the missing darwin-x64 binary is now included alongside darwin-arm64.
  • This also covers the linux x64+arm64 builds (built on a single x64 runner), which had the same cross-arch gap.

Regression guard (the "test")

Added scripts/verify-mac-universal-binaries.js, a build-time check (same pattern as the existing verify-xterm-request-mode-build.js) that scans the packaged .app and fails the build if either darwin pty.node is missing. It's wired into the universal mac build scripts (build:mac, build:mac:universal, build:mac:ci, release:mac, release:mac:universal), so it runs in both CI build paths and locally. The single-arch build:mac:x64 / build:mac:arm64 scripts are intentionally excluded since they legitimately ship one binary.

Testing notes (run locally on an Intel Mac, x86_64)

  • pnpm install → confirmed both @lydell/node-pty-darwin-x64 and -arm64 materialize; lockfile byte-identical.
  • pnpm run build:mac:ci → produced Pane-2.4.5-macOS-universal.dmg; both darwin pty.node binaries present in app.asar.unpacked; main executable is a true universal binary (lipo -archsx86_64 arm64).
  • Verify script: passes when both binaries present, exits 1 when the x64 binary is removed (confirmed it catches the regression).
  • Launched the app (x64 slice) on Intel hardware → starts normally, terminals work, no node-pty crash.

Note on NOTICES

This change adds no dependencies to package.json/the lockfile (it only affects which already-listed optional packages are materialized per machine), so NOTICES is intentionally not touched here. The release build regenerates NOTICES at build time, so shipped attributions stay correct.

Screenshot

Screenshot 2026-06-29 at 10 16 12

GitHub's macos-latest runner is arm64, so `pnpm install` only materialized
@lydell/node-pty-darwin-arm64. The --universal build then shipped a node-pty
loader that crashed on Intel Macs at startup, looking for the missing
@lydell/node-pty-darwin-x64 binary (issue dcouple#300).

Add `supportedArchitectures` to pnpm-workspace.yaml so pnpm materializes the
optional platform binaries for every OS/CPU we ship, not just the build
machine's own. The lockfile already lists all six platform packages, so this
only changes what is installed on each build machine; electron-builder still
prunes binaries that don't match the target platform.

Add scripts/verify-mac-universal-binaries.js as a build-time guard that fails
the build if either darwin binary is missing from the packaged app, and wire
it into the universal mac build scripts so it runs in CI and locally.

Fixes dcouple#300
@jonatankruszewski jonatankruszewski changed the title Fix node-pty crash on Intel Macs in universal build fix(ci): node-pty crash on Intel Macs in universal build Jun 29, 2026
@jonatankruszewski

Copy link
Copy Markdown
Contributor Author

Hi! Can I get please a review? @parsakhaz Thanks

@parsakhaz

Copy link
Copy Markdown
Member

Hi! Can I get please a review? @parsakhaz Thanks

Sorry in the middle of a move to SF, will review sometime today or tomorrow thanks!

@parsakhaz parsakhaz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the patch and regression surface. The pnpm supportedArchitectures change matches the node-pty optional dependency issue, the lockfile already contains the platform packages, and the verifier syntax/fixture behavior checks out locally. No app runtime regression found.

@parsakhaz parsakhaz merged commit bbae05f into dcouple:main Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node-pty crash on Intel Macs: "could not find platform-specific package @lydell/node-pty-darwin-x64" (universal build)

2 participants