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

Error occurs when using electron rebuilt with "electron-rebuild" #3818

Closed
3 tasks done
neolord0 opened this issue Jan 24, 2025 · 2 comments
Closed
3 tasks done

Error occurs when using electron rebuilt with "electron-rebuild" #3818

neolord0 opened this issue Jan 24, 2025 · 2 comments

Comments

@neolord0
Copy link

neolord0 commented Jan 24, 2025

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

7.6.0

Electron version

30.5.1

Operating system

macOS 15,2

Last known working Electron Forge version

No response

Expected behavior

I wanted to run a java program from a packaged electron app.

Actual behavior

The packaged electron app runs, but the java module does not work.

Steps to reproduce

Hello.
I'm trying to use Java with electron.

So, I installed it on my macOS like this:

nvm use 20.18.2

npm install --save java
npm install --save-dev [email protected]

And, I rebuilt electron to connect the two:

npm install --save-dev @electron/rebuild

package.json
  "scripts": {
    "start": "electron .",
    "rebuild": "electron-rebuild -f -w java",
  }

npm run rebuild
node node_modules/java/postInstall.js

After that, when I test the program, it works fine:

npm run start

Finally, to package it, I followed guide to install and run electron-forge.

The packaging process completed successfully, and the program runs, but the program terminates at the point where the JAVA module is executed. I think it's because the packaged electron is not rebuilt to link to java.

What should I do? I need help.

Additional information

No response

@erickzhao
Copy link
Member

Hi @neolord0, @electron/rebuild should already be run as part of the package and start commands in Electron Forge. There should be no need to run @electron/rebuild separately.

@erickzhao erickzhao closed this as not planned Won't fix, can't repro, duplicate, stale Jan 30, 2025
@neolord0
Copy link
Author

neolord0 commented Jan 30, 2025

First of all, thank you for your kind answer.

After reading your answer, I found out that Electron Forge uses @electron/rebuild internally.

I want to use node-java module with Electron.
It says that node-java module should be rebuilt with @electron/rebuild with the following command.

package.json
"scripts": {
"start": "electron .",
"rebuild": "electron-rebuild -f -w java",
}

npm run rebuild
node node_modules/java/postInstall.js

Actually, it didn't run unless I did this.

When Electron Forge uses @electron/rebuild, is there a way to add options or postInstalling script like the above?

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