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
[Bug]: app.relaunch() fails to restart app - It only exits. #31726
Comments
Please note that I tried packaging my electron app and it DOES work when packaged! Wierd. |
I have cloned and tested your testcase and I am getting the expected behavior on 15.3.0. Does your packaged version still work in the same directory as your Electron dependency |
I'm not sure I understand what you mean by the same directory because when packaged it goes into the "out" dir by default with Electron Forge. So I suppose, it is a completely different folder than in dev mode. Although I can confirm, that it works correctly on my Mac... I'll do some more testing on my windows machine, but I have already tried deleting the node_modules completely. I'll post back when I have more info. Thank you |
So I've tried a clean install of npm dependencies again. Then, messed around in the node_modules/electron/dist folder as I was trying to figure out what you meant. I tried placing my packaged .exe file beside the electron.exe file in the dist folder and tried running that without success. I don't see why it would have been useful. I can now confirm these things:
|
I found the problem: //auto-reload on save
if (isDev) {
try {
// You have to pass the module object so we can read the module graph and figure out which files belong to the main process.
// The try/catch is needed so it doesn't throw Cannot find module 'electron-reloader' in production.
require('electron-reloader')(module);
} catch {
//return
}
} If I comment out the previous lines, the app.relaunch works perfectly. |
I'm facing the same issue. The app reloads in production but not in development. I'm using Electron |
same issue here in electron 22.2.0 with electron-forge. it was working until just recently. restarting works fine on prod, but in dev the application never comes back (although I can still see some electron processes running on task manager, and I am unable to npm start my app again until I manually close them) relevant code:
|
Preflight Checklist
Electron Version
15.3.0
What operating system are you using?
Windows
Operating System Version
Windows 10.0.19043
What arch are you using?
x64
Last Known Working Electron version
15.2.0
Expected Behavior
app.relaunch() should restart the Electron application as expected.
Actual Behavior
The application only quits. It does not relaunch the app as it should.
Testcase Gist URL
https://github.com/alex-drocks/electron-15.3.0-win10-x64-app-relaunch-fails
Additional Information
For documentation I read this: https://www.electronjs.org/docs/latest/api/app#apprelaunchoptions
I have a production build using Electron v15.2.0 in which the app.relaunch() function still works as expected.
I also tried to use Electron v16 beta to see if it was fixed later in beta releases.
Testcase URL is a copy of the
electron-quick-start
where I jsut added a button in the renderer process to trigger the app.relaunch() function.The text was updated successfully, but these errors were encountered: