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

Dependency not included in packaged application because it contains executable code #8648

Open
ku4ndev opened this issue Oct 31, 2024 · 3 comments

Comments

@ku4ndev
Copy link

ku4ndev commented Oct 31, 2024

  • Electron-Builder Version: 25.0.5
  • Node Version: 22.5.1
  • Electron Version: 31.1.0
  • Electron Type (current, beta, nightly): Not using electron-updater
  • Target: Windows, portable

Hello,

The application I'm developing uses the java-bridge NPM package in order to use a JAR inside the application.
Everything runs fine when just running the application, but when packaging it doesn't (the first call that depends on java-bridge fails).

During the packaging process, the console shows that java-bridge is not being included in the asar archive because it contains executable code. I tried including those files using "asarUnpack" in package.json but it still doesn't work (tried both the portable executable aswell as the unpacked application).

I understand that this is due to security concerns; I was wondering if someone has been in the same situation and/or there is a workaround for this.

If there is any other relevant information I can provide let me know and I will provide it as soon as possible.

Thank you beforehand :)

@mmaietta
Copy link
Collaborator

the console shows that java-bridge is not being included in the asar archive because it contains executable code

Is java-bridge not showing up in the app.asar.unpacked folder? Off the top of my head, that's the default behavior when encountering executable code.

@ku4ndev
Copy link
Author

ku4ndev commented Nov 1, 2024

It is there although its missing some files when comparing the content with node_modules/java-bridge.
Could the files show up in app.asar.unpacked but be a reference issue? If so, do I have to treat dependencies outside of asar archive a bit different maybe?

@mmaietta
Copy link
Collaborator

mmaietta commented Nov 1, 2024

The files may be within the app.asar as the asar contains the metadata record of files-within-asar and symlinks-to-asar-unpacked, dependencies outside the asar should automatically be handled by the asar reader.

The best way for you to check that your app has all files/dependencies required, you can run npx asar extract <asar path> <out dir> and check the package contents/structure (it'll include both packed and unpacked files)

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