electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.65k stars 1.74k forks source link

Including SoX static binary in Electron app Error: spawn / EACCES #8567

Open Drecula opened 2 weeks ago

Drecula commented 2 weeks ago

electron-builder: 25.1.7

node: v22.4.0

electron: 32.1.2

Mac arm64

I have an Electron app that I build, sign, notarize, and staple using electron-builder. It includes Sound Exchange (SoX), which I was invoking from the homebrew installed version. It builds a dmg and works fine.

However, my users are non-technical, thus cannot be expected to install dev tools, homebrew, and sox from the command line and set paths.

Therefore, I need to include a SoX binary in my app. I have a static SoX binary that works. However, when I try to run it from my electron app, I getError: spawn / <path>/sox EACCES.

Electron-builder is signing the SoX binary codesign --sign <sign number> --force --timestamp --options runtime --entitlements dist/entitlements/entitlements.mac.plist /<app path>Contents/Resources/bin/sox/sox

The app sign/notarize works fine, the dmg mounts, and the app runs until I try to invoke SoX. Also, I verified the sox binary and entire app are signed and the app staple is valid. I am running the app from /Applications

Please help!

extraResources:
  - from: 'bin/sox'
    to: 'bin/sox'

binaries:
  - 'Contents/Resources/bin/sox/sox'
mmaietta commented 2 weeks ago

Hmmm, what's the code you're using to identify the path of the SoX binary and running it?

Can you share a minimum reproducible repo that I could test locally with?

Drecula commented 2 weeks ago

Example from Library approach. I will try to add this to my ’toy’ electron project to see if I can reproduce the problem, then share with you.

const soxPath = path.join(process.resourcesPath, '..', 'Library', 'Helpers', 'sox', 'sox’) const audioRecorder = spawn(soxPath, soxArgs)

On Oct 8, 2024, at 11:56 AM, Mike Maietta @.***> wrote:

Hmmm, what's the code you're using to identify the path of the SoX binary and running it?

Can you share a minimum reproducible repo that I could test locally with?

— Reply to this email directly, view it on GitHub https://github.com/electron-userland/electron-builder/issues/8567#issuecomment-2400232392, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUCS226QXYQTHGRMBYYDATZ2P6BVAVCNFSM6AAAAABPOTDHISVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBQGIZTEMZZGI. You are receiving this because you authored the thread.