Julusian / node-jpeg-turbo

Limited libjpeg-turbo bindings for Node.js.
Other
14 stars 12 forks source link

Issue while using Electron Forge #9

Open ninjadev64 opened 1 year ago

ninjadev64 commented 1 year ago
> tsc && electron-forge make

✔ Checking your system
etBuil…
  build_file_data = LoadOneBuildFile(
  File "/Users/aman/GitHub Desktop/OpenDeck/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 237, in LoadOneBuildFi…
  build_file_data = eval(build_file_contents, {"__builtins__": {}}, None)
  File "binding.gyp", line 2
  # https://github.com/electron-userland/electron-builder/issues/3938
  ^
  SyntaxError: unexpected EOF while parsing
  Error: `gyp` failed with exit code: 1
  at ChildProcess.onCpExit (/Users/aman/GitHub Desktop/OpenDeck/node_modules/node-gyp/lib/configure.js:325:16)
  at ChildProcess.emit (node:events:514:28)
  at ChildProcess._handle.onexit (node:internal/child_process:291:12)

An unhandled rejection has occurred inside Forge:
Error: node-gyp failed to rebuild '/private/var/folders/fr/6c96j67x5ps0l3wrj9ytfpkw0000gp/T/electron-packager/darwin-x64/opendeck-darwin-x64-nJ15u0/Electron.app/Contents/Resources/app/node_modules/@julusian/jpeg-turbo'
at ChildProcess.<anonymous> (/Users/aman/GitHub Desktop/OpenDeck/node_modules/@electron/rebuild/lib/module-type/node-gyp/node-gyp.js:118:24)
    at ChildProcess.emit (node:events:514:28)
    at ChildProcess._handle.onexit (node:internal/child_process:291:12)

I can see it mentions electron-userland/electron-builder#3938 in a file attempting to fix this error, but the workaround seems to no longer work...

ninjadev64 commented 1 year ago

Node v18.17.1 node-jpeg-turbo v2.1.0 Electron Forge v6.4.1 (@elgato-stream-deck/node v5.7.3)

Julusian commented 1 year ago

I think this is hitting https://github.com/electron/rebuild/issues/1055

As I changed the prebuilds to be part of the npm package rather than being installed via prebuild-install in v2.0.0, maybe this hack to get electron-builder to rebuild the library is unnecessary. It does mean that cross building for any platform that prebuilds arent provided for will not work, but the chances of being able to compile the binary in that scenario is highly unlikely.

ninjadev64 commented 1 year ago

I think this is hitting electron/rebuild#1055

As I changed the prebuilds to be part of the npm package rather than being installed via prebuild-install in v2.0.0, maybe this hack to get electron-builder to rebuild the library is unnecessary. It does mean that cross building for any platform that prebuilds arent provided for will not work, but the chances of being able to compile the binary in that scenario is highly unlikely.

Oh, alright, thanks - what should I do to get my builds working again?

Julusian commented 1 year ago

Could you try deleting the node_modules/@julusian/jpeg-turbo/binding.gyp file in your project folder? That will fix it short term, and will confirm that my planned solution will work for you

ninjadev64 commented 1 year ago

Could you try deleting the node_modules/@julusian/jpeg-turbo/binding.gyp file in your project folder? That will fix it short term, and will confirm that my planned solution will work for you

Seems to have fixed it, thanks!

ninjadev64 commented 11 months ago

Do let me know when the long-term solution is available as this is a minor inconvenience, having to be added as a step in CI builds and explained to others trying to build my project ;)