-
Notifications
You must be signed in to change notification settings - Fork 288
Open
Description
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-helperEnvironment
- 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
- [bug] posix_spawnp failed after calling spawn multiple times #670 - posix_spawnp failed (different root cause)
- Got Error: posix_spawnp failed in packaged electron js app #789 - posix_spawnp in Electron (different root cause)
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
Labels
No labels