question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Run electron-forge on the Linux Subsystem for Windows (WSL)

See original GitHub issue

electron-forge does not work on the WSL by default. This is expected since WSL can’t run GUI applications on linux. When using “vanilla” electron through the WSL manually installing the win32 version of electron fixes this issue. (see here) Unfortunatly, this approach results in this error when using electron-forge

(electron:325): Gtk-WARNING **: cannot open display:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test@1.0.0 start: `electron-forge start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

It seems like the reinstalling of electron had no effect - even though im unsure why this is happening.

Instructions to reproduce:

  • Install the Debian WSL
  • Install electron-forge in wsl
  • electron-forge init test ; cd test
  • npm install && npm uninstall electron && export npm_config_platform=win32 && npm install electron && unset npm_config_platform
  • npm start

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
maleptcommented, Aug 9, 2018

I’ve talked to some Electron devs who are more familiar with the Windows environment than I am, and the consensus is that you should be using WSL + Forge just to package for Linux (i.e., .deb, .rpm, Snap). For the development cycle, you should be using Windows proper (e.g., CMD/Powershell for CLI).

2reactions
maleptcommented, Aug 9, 2018

As Paul said, you’ll need an X server running if you want to run an Electron app under WSL without a lot of headaches (which uses the Linux target, because you’re technically running under Linux).

Feel free to try to figure out how to get a Forge project with a Windows target working (I would suggest using the v6 beta instead of v5, if only because we’re not adding any new features to v5), and if it ends up being a relatively clean solution (unlike that fourth bullet point in your repro instructions), you should definitely file an issue/PR in the appropriate project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developing with WSL - Electron Forge
If you're using Windows Subsystem for Linux (WSL), there are some quirks to running Electron apps. Since you can run a mostly complete...
Read more >
Building an Electron App in Windows with WSL 2 and Ubuntu
You can use yarn run electron:build command to create linux binaries. 5. Setting Up An Editor (And Other Tools). You might think (like...
Read more >
Run electron-forge on the Linux Subsystem for Windows (WSL)
Instructions to reproduce: Install the Debian WSL; Install electron-forge in wsl; electron-forge init test ; cd test; npm install && npm ...
Read more >
Unable to run Electron Quick Start in WSL - Stack Overflow
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/ ...
Read more >
Build a cross-platform Electron App in Windows with WSL and ...
Check out Matthew's blog: https://www.beekeeperstudio.io/blog/building- electron - windows - ubuntu -wsl2For more info see https:// ubuntu.com/ wsl.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found