2

Update — Figured out it thanks to somebody else experiencing the exact same problem right around the exact same time mine must have gone haywire, oddly enough.

I have not worked on my Electron projects in weeks, and in the meantime Electron suddenly stopped working. Even if I create a new project, it seems to start and then end immediately without any errors, warnings, or notifications, and without ever launching the Electron window. Task Manager confirms that Electron never even launches.

  • Electron Quick Start does not work.
  • Uninstalling and reinstalling does not work.
  • However, Electron Fiddle is able to launch Electron.

Anybody have any idea what could be causing this?

enter image description here

  • Windows 10 Home 1903 build 10.0.18362, 1909 build 18363.535
  • Node 12.8.1, 12.13.0, 12.14.0
  • NPM 6.13.4
  • Electron 7.1.4, 7.1.7

I am not sure if this is relevant, but if I try to run npx electron it tells me Electron failed to install correctly, please delete node_modules/electron and try installing again...?


The issue has also been posted to the Electron GitHub page over here.

oldboy
  • 5,729
  • 6
  • 38
  • 86
  • What do you see when you pass `-v` argument to `npm start`? This command: `npm start -v` – Asesh Dec 13 '19 at 05:12
  • @Asesh 6.13.4 ?? – oldboy Dec 13 '19 at 05:31
  • sorry my bad. Pass this instead: `--enable-logging --v=1` of `-v` – Asesh Dec 13 '19 at 06:48
  • @Asesh same result: `6.13.4` – oldboy Dec 13 '19 at 06:49
  • @Asesh i also posted the issue to the electron github page over [here](https://github.com/electron/electron/issues/21503). the issue even happens if i create brand new projects – oldboy Dec 13 '19 at 06:57
  • Anything visible in the event log? – Martin Hertig Dec 13 '19 at 07:25
  • @MartinHertig where would i find that? – oldboy Dec 13 '19 at 07:37
  • e.g. on win10, run the command "compmgmt.msc". then go to event viewer on the tree menu on the left, and crawl through the windows logs (application, system most probably ...). Hope that helps (and i got it right, only have a german windows here ...) – Martin Hertig Dec 13 '19 at 07:47
  • 1
    @MartinHertig ahhh i think just opening 'event viewer' is what youre talking about? i cant find anything significant or anything that corresponds to running the script tho – oldboy Dec 13 '19 at 08:13
  • @oldboy My guess this could be a windows or virus/antivirus issue. I just created a new project and everything is working as expected. Win: 1909, Node: 12.14, Electron 7.1.7. Try to check your running process by [Process Explorer](https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer) to see if there is anything suspicious. – awran5 Dec 28 '19 at 08:28
  • It looks like a `nodejs` installation issue. You should always use the NodeJS version that electron is build on. For example, electron 7.1.x is built on node 12.8.1. Install and use [Node Version Manager](https://github.com/coreybutler/nvm-windows) and switch to exact nodejs version before you run any electron project. You should also try and use `yarn` instead of `npm`. I've faced some issues using `npm` on the past. Lastly, when you have such issues, try delete both `node_modules` directory and `package-lock.json` (or `yarn.lock`) and then reinstall node modules. – Christos Lytras Dec 28 '19 at 09:18
  • @awran5 Thanks. I will keep my eyes peeled. Funny enough, I was also experiencing a network connection loss issue recently, although I never noticed any unusual resource usage, and the connection issue has subsided after rolling back Windows and a few other programs. I will try uninstalling and reinstalling everything again. – oldboy Dec 28 '19 at 21:35
  • @ChristosLytras Duly noted, but @awran5 said he got Electron 7.1.7 working with Node 12.14, so... I think I will try uninstalling and reinstalling everything again. Man, I am really hesitant to switch from `npm` to `yarn` because I have no idea how `yarn` works and do not really want to invest what little free time I have into learning it :( – oldboy Dec 28 '19 at 21:38
  • @oldboy there is nothing you need to do to use yarn except installing it... Of course node version > built in electron node version will seem to work, but you may hit up on issues that come from versions incompatibilities, deprecation's or unimplemented features and these will not be so obvious what the culprits may be. – Christos Lytras Dec 28 '19 at 22:10
  • @oldboy no need to switch to yarn, I've done the test using npm just to make sure its not npm/yarn issue. – awran5 Dec 28 '19 at 22:20
  • @ChristosLytras yeah, but id have to learn the yarn syntax :( – oldboy Dec 28 '19 at 22:52
  • @awran5 yeah, i dont know whats going on because i uninstalled, rebooted, reinstalled, and still nothing. – oldboy Dec 29 '19 at 00:53
  • @ChristosLytras tried uninstalling, rebooting, reinstalling and still no dice. this is driving me nuts... i just wanna work – oldboy Dec 29 '19 at 01:08
  • If your unable to create a new project it's a node issue. – Tom Shaw Dec 29 '19 at 01:10
  • @TomShaw i can create a new project, but when i go to start the project it starts and ends immediately without even launching electron :/ – oldboy Dec 29 '19 at 01:16
  • @ChristosLytras could the issue be that the "open with default program" is visual studio for HTML and JS files? i tried switching the default program for HTML files to Chrome, but that didnt seem to do the trick? – oldboy Dec 29 '19 at 01:22
  • @awran5 figured it out – oldboy Dec 29 '19 at 06:50
  • @ChristosLytras figured it out – oldboy Dec 29 '19 at 06:51

1 Answers1

0

Delete the cache folders under your AppData/Local and AppData/Roaming for electron, electron-builder and any of your apps that is still not working.

Abdessattar
  • 114
  • 5
  • Just tried that, but no dice. Deleted the `Cache` folder of `AppData\Local\Electron` and `AppData\Roaming\ProjectName`. Thanks for the suggestion nonetheless. – oldboy Dec 13 '19 at 10:09