james
james

Reputation: 525

Cypress unable to open X Display in WSL2

I have followed every single step in this tutorial. Double Checked. Double Installed.

https://nickymeuleman.netlify.app/blog/gui-on-wsl2-cypress

But I get the error :

[3974:0912/194522.792278:ERROR:browser_main_loop.cc(1402)] Unable to open X display.
The futex facility returned an unexpected error code.
The Test Runner unexpectedly exited via a exit event with signal SIGABRT

Upvotes: 5

Views: 3406

Answers (2)

Ben Whitmore
Ben Whitmore

Reputation: 967

If you've configured an external nameserver, then following the steps of Nicky Meuleman's tutorial, the DISPLAY variable will be set wrong. The tutorial says to add this to your .bashrc:

export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0

... but if you've configured an external nameserver, DISPLAY will end up pointing to that server, and it won't work. Instead, you should do this:

export DISPLAY=$( cmd.exe /C netsh interface ip show addresses "vEthernet (WSL)" | grep "IP Address" | sed -e "s/\sIP Address:\s//g; s/\r//" ):0.0

This will set DISPLAY to (e.g.) 172.24.0.1:0.0 instead of 8.8.4.4:0.0.

Upvotes: 1

Scott McAllister
Scott McAllister

Reputation: 538

I had a similar issue, but there was a line before that same error message about Authentication. For me, I had to Disable Access Control after first ensuring all other running instances of VcXsrv were terminated:

Disable access control

Upvotes: 4

Related Questions