Reputation: 2843
I have this ElectronJS project that I finally managed to build correctly (no errors when building). But when I am trying to start it, I just get this error:
npm ERR! code ELIFECYCLE
npm ERR! errno 4294930435
npm ERR! [email protected] start: `electron dist/main.js`
npm ERR! Exit status 4294930435
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Anoneemo\AppData\Roaming\npm-cache\_logs\2021-01-22T16_56_16_185Z-debug.log
I can't make sense of the debug.log file either.
But when I try to launch the application with electron dist/main.js --enable-logging
instead of the npm start script, I get this in the console:
[16724:0122/180054.390:ERROR:crashpad_client_win.cc(808)] not connected
. I have tried removing the node_modules
folder, installing again, verifying the cache, restarting the computer and pretty much everything I could dig up on google.
Does anyone know what could be wrong here? It launched fine before I had the error when building. Then I got error when building and fixed that by simply adding an exclude to my webpack babel-loader. Then it builds fine, but wont startup at all. The whole project can be found here: movie-ex.
Any clues anyone? Thanks in advance!
Upvotes: 1
Views: 4018
Reputation: 158
just remove this line inside createWindow function in main.js
nodeIntegration: true,
Upvotes: -1
Reputation: 3247
Noting that I do not use webpack, I received the exact same error after upgrading Electron from v8.1.0 to v11.2.0
My error appeared to originate from the use of the "__dirname" variable when used in the Electron "new BrowserWindow" -> "icon" setting.
As you are using modules, I suspect it may have something to do with the "new BrowserWindow -> webPreferences -> nodeIntegration" and "contextIsolation" scope settings, thus your need to set __dirname: true
in your "webpack.config.js" file (Ref: https://webpack.js.org/configuration/node/)
PS: I'm not full bottle on the updated Electron "nodeIntegration" and "contextIsolation" settings as I only updated my app this morning for the first time in a long time and learnt of the changed / pending default setting(s) of Electron v12.
More information can be found below:
Funnily enough, my original "icon" value was icon: __dirname + '',
. I had set this early on during development and subsequently forgot to point it to a proper *.ico file later on.
I just created an "icon.ico" file and set the "icon" value accordingly.
icon: __dirname + '/../../../icons/icon.ico'
This seemed to work.
As an alternative, I also tried the following (with the "icon" line commented out).
win.setIcon(__dirname + '/../../../icons/icon.ico');
This worked as well.
Note to self: Refactor to the path -> join function.
Important: That all said, I currently have set nodeIntegration: true
. Better sort this out before upgrading to Electron v12.
Upvotes: 1