Skip to content

macOS: spawn-helper shipped without execute bit in npm tarball causes posix_spawnp failures (pnpm) #850

@3mdistal

Description

@3mdistal

Description

The spawn-helper binary in the darwin prebuilds is published to npm without the execute permission bit (644 instead of 755), causing posix_spawnp failed errors when using package managers that preserve file permissions during extraction.

This primarily affects pnpm users, as pnpm's content-addressable store preserves the original tarball permissions, whereas npm/yarn may not exhibit the issue due to different extraction behavior.

Steps to Reproduce

mkdir test-pty && cd test-pty
npm init -y
pnpm add node-pty

# Check permissions - shows 644 instead of 755
ls -la node_modules/.pnpm/node-pty@1.1.0/node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper

# Try to use node-pty
node -e "require('node-pty').spawn('/bin/echo', ['test'])"

Expected Behavior

spawn-helper should have execute permission (755) and the spawn should succeed.

Actual Behavior

Error: posix_spawnp failed.
    at new UnixTerminal (node_modules/node-pty/lib/unixTerminal.js:92:24)

The tarball contains spawn-helper with 644 permissions:

$ npm pack node-pty@1.1.0 && tar -tvf node-pty-1.1.0.tgz | grep spawn-helper
-rw-r--r--  0 0      0       50480 Oct 26  1985 package/prebuilds/darwin-arm64/spawn-helper
-rw-r--r--  0 0      0        9248 Oct 26  1985 package/prebuilds/darwin-x64/spawn-helper

Workaround

chmod +x node_modules/.pnpm/node-pty@*/node_modules/node-pty/prebuilds/darwin-*/spawn-helper

Environment

  • node-pty: 1.1.0
  • Node.js: v25.2.1 (also reproduced on v22.x)
  • OS: macOS (darwin-arm64)
  • Package manager: pnpm 10.11.0

Related Issues

Suggested Fix

Ensure spawn-helper has execute permission when creating prebuilds. This might be addressed in the prebuild pipeline or by setting file modes before npm pack.

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