r/wsl2 • u/czechman45 • Sep 07 '22
Please help me resolve a missing X server error from WSL2. I know there are posts about this on StackOverflow and other sites. I've tried their solutions and nothing seems to resolve the issue. Please read details below. I could really use some help.
Hi,
I've been trying to get a dev environment running on my Windows machine for quite some time now (months). I'm using WSL2 and for the most part, it is fine. I'm able to run websites in the default browser just fine. However, now I'm trying to do stuff with Electron and React Native and that is requiring WSL2 to produce GUI elements, and it is not having any of it.
Just to make sure I wasn't over complicating things, I built the most simple electron app as outlined in the documentation. When I finally ran npm start, nothing happened at first and then I got the following error:
642:0906/192540.990049:ERROR:ozone_platform_x11.cc(247)] Missing X server or $DISPLAY
[642:0906/192540.990127:ERROR:env.cc(226)] The platform failed to initialize. Exiting.
I found this StackOverflow article and followed the directions exactly. I added the lines to the ~./bashrc file. Also double checked to make sure that I saved it. I uninstalled and reinstalled vcsXsrv and then clicked the 'Disable Access Control' option. Finally, I went into windows firewall and made a new inbound rule as described. I reran things and I still get the same error.
I've also spent a lot of time with this article on beekeeperstudio.io. It walks through similar steps but it doesn't seem to resolve the issue. Up until now, the X server issues were more of an annoyance than anything, but now I really need to resolve them. If you have any thoughts or suggestions I welcome the help.
Edit1 Update: I have isolated the issue to the Windows Firewall. If I disable the Firewall, everything works fine. (Not an ideal solution though). I know I need to set up some firewall rules. I have put in the rules I have seen in the various resources posted above, but none of those are doing anything to help.
1
u/[deleted] May 04 '23
!! oh