Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module build fails with empty binding.gyp #1127

Open
pablo-mendoza opened this issue Feb 22, 2024 · 3 comments
Open

Module build fails with empty binding.gyp #1127

pablo-mendoza opened this issue Feb 22, 2024 · 3 comments

Comments

@pablo-mendoza
Copy link

Hello, I'm trying to use audify (https://github.com/almoghamdani/audify) in an electron app with electron-forge.

When the electron-rebuild step runs it tries to rebuild audify build fails with the error at the end.

The module actually uses cmake-js to build and builds fine if build using npm run rebuild. It actually worked fine with electron-rebuild at some point but something updated and it doesn't work anymore. not sure if the issue is in electron-rebuild or node-gyp.

\ Building module: audify, Completed: 0gyp: Unable to find targets in build file binding.gyp while trying to load binding.gyp
Error: `gyp` failed with exit code: 1
    at ChildProcess.onCpExit (C:\code\wiservibe\electron\node_modules\@electron\rebuild\node_modules\node-gyp\lib\configure.js:325:16)
    at ChildProcess.emit (node:events:513:28)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)

× Rebuild Failed

An unhandled error occurred inside electron-rebuild
node-gyp failed to rebuild 'C:\code\wiservibe\electron\node_modules\audify'

Error: node-gyp failed to rebuild 'C:\code\wiservibe\electron\node_modules\audify'
    at ChildProcess.<anonymous> (C:\code\wiservibe\electron\node_modules\@electron\rebuild\lib\module-type\node-gyp\node-gyp.js:118:24)
    at ChildProcess.emit (node:events:513:28)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)


@tarekis
Copy link

tarekis commented Mar 1, 2024

This is caused by the same issue as #1116.

See #1116 (comment) for a workaround.

@pablo-mendoza
Copy link
Author

pablo-mendoza commented Mar 1, 2024

It doesn't seem like node-rebuild does anything at all when forced to run with [email protected]. It just hangs there claiming to be building but no compiler commands are actually running

Also doesn't seem to be python related, I tried with a few different versions and it doesn't work either.

@tarekis
Copy link

tarekis commented Mar 2, 2024

Hey, thanks for letting me know, that pointed to a flawed conclusion on my side.
I have been fiddling around with this quite a bit and it was a side-effect I hacked in that made this work, sorry for the confusion.

Additionally to the proposed solution you need to change node_modules\@electron\rebuild\lib\module-type\node-gyp\worker.js:29 and un-pomisify the node-gyp call, the worker pomisifies a promise-returning function and thus hangs forever. Might try to get this into a PR and approved into the project, not sure how well that will go.

If this does not fix it, it's probably the library you are trying to build. Errors like the one you reported above were constantly thrown for me until I fixed the linked issue tho.
Since the linked issue produced those exact errors, I assume the bindings.gyp error can also result from a subcommand not being executed correctly because node-gyp and your python version don't work together. They look similar to the following one for node-canvas in my current project:

node-gyp  rebuild --runtime=electron --target=27.2.0 --arch=x64 --dist-url=https://www.electronjs.org/headers --build-from-source --verbose --module_name=canvas --module_path=D:\\_projects\\[...]\\node_modules\\.pnpm\\[email protected]\\node_modules\\canvas\\build\\Release --host=https://github.com/Automattic/node-canvas/releases/download/ --remote_path=v2.11.2 --package_name=canvas-v2.11.2-electron-v27.2-win32-unknown-x64.tar.gz

It's also possible there is an actual error with a bindings.gyp file, tho.

And as you can see the node-gyp project properly exposes binding.gyp, while audify does too, but an empty one. Still - while I must admit, I have no idea if the empty bindings file is allowed and I just assume it is -, if you report this used to build with a previous version, I'd still think it's a electron-rebuild and subsequently a node-gyp error.

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

No branches or pull requests

2 participants