Skip to content
Advertisement

Unable to run Electron Quick Start in WSL

Hi I’m running Ubuntu 16.04.3 LTS on Windows Subsystem Linux. I’m trying to run the Quick Start first app as listed in this section here https://electronjs.org/docs/tutorial/first-app however, I keep getting the same error no matter if I clone the repository, write it myself, or delete and reinstall the Electron module.

> electron .

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! first-electron@1.0.0 start: `electron .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the first-electron@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

For reference I’m running Node: 9.11.1 NPM: 5.8.0

Advertisement

Answer

Electron needs to open a chrome browser window. So, when you run it from WSL using a node.js that was installed in WSL, I guess it would try to start the chromium browser for Ubuntu, which will not work out of the box, because:

Microsoft doesn’t support graphical programs on WSL. Bash on WSL is intended for running command-line programs that developers might need, but it’s possible to run graphical Linux desktop programs on Windows using the Bash shell. To be more precise, you’ll be able to display graphical programs running in WSL on a Windows 10 desktop by using an X server which runs on Windows 10.

https://virtualizationreview.com/articles/2017/02/08/graphical-programs-on-windows-subsystem-on-linux.aspx

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement