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 launching app | Electron exited with signal SIGTERM. | Electron exited with code 3489660927. #1515

Closed
lopezvoliver opened this issue Dec 3, 2023 · 4 comments

Comments

@lopezvoliver
Copy link

I added the following code to the template electron fiddle in main.js (complete gist available here) to investigate an issue I am having developing an extension in vscode:

  var XmlHttpRequest = require("xmlhttprequest").XMLHttpRequest;
  xmlHttp = new XmlHttpRequest();
  try{
  xmlHttp.open("GET", "", false);
  xmlHttp.send(""); 
  console.log(xmlHttp.responseText); // Should return undefined
  }catch(err){
    console.log(err);
  }

Note that the above code works when running through node and the expected output is:

$ node testXmlHttpRequest.js 
undefined

In electron fiddle (0.34.5 in Windows; Electron v27.0.4), the app fails to launch with the following error (pasting as image below, as the text can't be copied from the popup).

image

The error message starts with "Error launching app" and then complains about being Unable to find Electron app at C:\Users\myusername\AppData\Local\Temp\electron\electron-fiddle-randomString\ and the following seems to be this code from the xmlhttprequest library

In the console, there is no error message, except for either "Electron exited with signal SIGTERM." or "Electron exited with code 3489660927.".

Is this a bug in electron/fiddle or electron/electron, or am I missing something? As I am testing using fiddle, I am submitting the issue here, but I suspect it might be from electron.

@dsanders11
Copy link
Member

Is this a bug in electron/fiddle or electron/electron, or am I missing something? As I am testing using fiddle, I am submitting the issue here, but I suspect it might be from electron.

It's not a bug in either. You can rule out Fiddle by saving the fiddle to disk and running it directly with Electron and see the same result (via yarn start, for example).

The library you're using, xmlhttprequest, is the problem. It tries to spawn a new Node.js process and pass code as a string, which isn't going to work with Electron and leads to the error you see. Refs https://github.com/driverdan/node-XMLHttpRequest/blob/97966e4ca1c9f2cc5574d8775cbdacebfec75455/lib/XMLHttpRequest.js#L483-L507

@dsanders11 dsanders11 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 6, 2023
@lopezvoliver
Copy link
Author

How would one go about "catching" the error then? and why does the same code work "as is" in node?

@dsanders11
Copy link
Member

You can't catch the error, the error is coming from a separate process which is being spawned and failing to start. It works in Node.js because the module was designed for Node.js and is intending to spawn Node.js with the -e option, an option which Electron does not support.

@lopezvoliver
Copy link
Author

Thanks @dsanders11 , I finally understood what you meant: the issue is that process.argv[0] when launched from electron points to ./node_modules/electron/dist/electron, so it is the equivalent of attempting to do:

~/testElectron$ ./node_modules/electron/dist/electron -e "console.log('hey')"
Error launching app
Unable to find Electron app at /home/lopezom/testElectron/console.log('hey')

Cannot find module '/home/lopezom/testElectron/console.log('hey')'
Require stack:
- /home/lopezom/testElectron/node_modules/electron/dist/resources/default_app.asar/main.js
- 

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