rebuild icon indicating copy to clipboard operation
rebuild copied to clipboard

v3.2.8 breaks packaging electron app with ffi-napi dependency

Open t57ser opened this issue 1 year ago • 15 comments

Following error is thrown:

An unhandled rejection has occurred inside Forge: Error: /m/i1/temp/buildTmp/electron-packager/linux-x64/test-x64/resources/app/node_modules/ffi-napi/build/node_gyp_bins/python3: file links out of the package

Using electron-forge 6.0.0-beta.64 with electron 20 beta and ffi-napi 4.0.3 Only happens on mac and linux

Once i revert back to 3.2.7 packaging the application is working again.

t57ser avatar Jul 19 '22 12:07 t57ser

@t57ser Can you include the module that's breaking, or a repro of the break in Electron Fiddle? We're able to build a module with ff-napi without seeing this error, just want to try and get a repro for a deeper look 👀

VerteDinde avatar Jul 28 '22 19:07 VerteDinde

@VerteDinde Here you go: https://gist.github.com/t57ser/3be2bc0d590690ece381f69e8c316edf remember this only happens on mac, not on windows

An unhandled rejection has occurred inside Forge:
Error: /var/folders/sp/141453k53mg70282wr9vkn_h0000gp/T/electron-packager/darwin-x64/test-darwin-x64/Electron.app/Contents/Resources/app/node_modules/ffi-napi/build/node_gyp_bins/python3: file links out of the package

t57ser avatar Jul 28 '22 19:07 t57ser

Sorry @t57ser, could you include the Mac/Linux arch you're using, and the version of Electron 20-beta? I've been trying to repro on Mac arm64 using your gist, and I haven't been able to hit this error. We have another maintainer on Linux who was also trying to repro on Ubuntu 22.04 / Xorg (using Electron 20.0.0-b13 and electron-rebuild 3.2.8) who is also not able to repro.

Maybe this is specific to a Python version or arch? Just trying to get more details so we can try to fix this before Electron 20 stable for you 🤔

VerteDinde avatar Jul 29 '22 16:07 VerteDinde

macOS Monterey 12.4. x86_64 electron 20.0.0-beta.11 I am quite surprised you can not reproduce this since i have tried this on multiple machines I just tried a brand new mac, installed node etc... and same error

t57ser avatar Jul 29 '22 17:07 t57ser

Starting electron works, but packaging does not work, maybe that is the misunderstanding. So in my example that i send, you need to npm run package

t57ser avatar Jul 29 '22 17:07 t57ser

I'm having the same issue, trying to compile for electron 16. I can see the issue in Linux and macOS, I haven't tested Windows yet. Here's the output I get from a GitHub action. It's the same error I get on my local machines:

https://github.com/headsetapp/headset-electron/runs/7615723093?check_suite_focus=true

fcastilloec avatar Aug 01 '22 16:08 fcastilloec

Here's my terminal output when trying to reproduce on an arm64 Mac (Monterey) with both E20.0.0-beta.11 and E20.0.0-beta.13, running npm run package with Fiddle using @t57ser's gist above: output-packaging.txt

The only change between 3.2.7 and 3.2.8 is this change, which doesn't force a config rebuild when using alpha and/or beta 🤔 : https://github.com/electron/electron-rebuild/pull/1023/files I'm not sure how this is affecting the python link, and it's interesting that this seems to be happening independent of the Electron version. I'll test a x64 Mac and see if this could be an architecture difference.

VerteDinde avatar Aug 01 '22 17:08 VerteDinde

The only change between 3.2.7 and 3.2.8 is this change, which doesn't force a config rebuild when using alpha and/or beta thinking : https://github.com/electron/electron-rebuild/pull/1023/files I'm not sure how this is affecting the python link, and it's interesting that this seems to be happening independent of the Electron version. I'll test a x64 Mac and see if this could be an architecture difference.

That is not the only change introduce in this version, it's the only one reported on the Releases page. Here's the list of changes: https://github.com/electron/electron-rebuild/compare/v3.2.7...v3.2.8 Multiple dependencies have been upgraded, and at least two of them have been a major version change with breaking changes: detect-libc and node-gyp. Perhaps the problem is with some of those dependencies.

fcastilloec avatar Aug 01 '22 17:08 fcastilloec

@fcastilloec Thanks for the call-out, you're right! I think this may be the source of the issue: https://github.com/nodejs/node-gyp/commit/b9ddcd5bbd93b05b03674836b6ebdae2c2e74c8c We'll get this fixed

VerteDinde avatar Aug 01 '22 19:08 VerteDinde

Maybe this is specific to a Python version or arch?

Have never seen Python generate a file links out of the package message. Please see https://github.com/nodejs/node-gyp/issues/2713#issuecomment-1222259434

cclauss avatar Aug 22 '22 13:08 cclauss

The problem is the major version upgrade of node-gyp in a minor version, IMHO this should not permitted since it break the semantic versioning logic. A minor update should be safe.

For some reason node-gyp developer added a link to the python interpreter inside the build directory, that electron applications try to pack in the bundle, and obviously a link to the filesystem inside an application bundle is not allowed...

https://github.com/nodejs/node-gyp/issues/2713

... they have a PR for this on node-gyp, but maybe it's better to release a .10 release of electron-rebuild that fixes this as electron packager, asar and other did....

ggreco avatar Aug 26 '22 09:08 ggreco

Please provide a code review on nodejs/node-gyp#2721 to encourage maintainers to merge it.

cclauss avatar Aug 26 '22 10:08 cclauss

Would love to see some sort of fix for this.

jagthedrummer avatar Feb 04 '23 16:02 jagthedrummer

I was finally able to work around this by adding a resolutions block to my package.json that looks like this:

  "resolutions": {
    "**/**/fsevents": "^1.2.9",
    "**/**/node-gyp": "^8.4.0"
  }

jagthedrummer avatar Feb 06 '23 17:02 jagthedrummer

Thank you @jagthedrummer - I can confirm it works, finally fixed the issue:

An unhandled rejection has occurred inside Forge:
Error: /tmp/electron-packager/win32-ia32/Flow-win32-ia32/resources/app/node_modules/bufferutil/build/node_gyp_bins/python3: file "../../../../../../usr/bin/python3.10" links out of the package

Electron Forge was terminated. Location:
{}
error Command failed with exit code 1.

Mykolaichenko avatar Feb 23 '23 20:02 Mykolaichenko