Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setup Cypress on WSL ubuntu for windows 10

I am trying to setup Cypress on WSL ubuntu for windows 10 machine. WSL ubuntu does not come up with its own display. Hence, we need to follow few steps before setting up Cypress. I followed all the steps mentioned in the blog here: https://nickymeuleman.netlify.app/blog/gui-on-wsl2-cypress But I keep getting the following error:

Cypress failed to start.

This is usually caused by a missing library or dependency.

The error below should indicate which dependency is missing.

https://on.cypress.io/required-dependencies

If you are using Docker, we provide containers with all required dependencies installed.

----------


(Cypress:1690): Gtk-WARNING **: 10:15:51.766: cannot open display: 183.87.117.18:0.0

----------

Platform: linux (Ubuntu Linux - 18.04)
Cypress Version: 4.6.0

I have also installed XLaunch for windows 10. Was anyone able to resolve this issue earlier ? Could anyone please help me resolve this ?

Thanks

like image 222
Ashy Ashcsi Avatar asked Jun 29 '20 15:06

Ashy Ashcsi


People also ask

Can you run Ubuntu GUI on WSL?

Windows Subsystem for Linux (WSL) allows you to install a complete Ubuntu terminal environment in minutes on your Windows machine, allowing you to develop cross-platform applications without leaving windows.


1 Answers

Got the idea from here: https://github.com/microsoft/WSL/issues/4106#:~:text=you%20may%20also%20need%20to%20launch%20vcxsrv%20with%20the%20-ac%20argument.

If you have XLaunch running - exit it by double-clicking on the icon in the taskbar and click Exit;

Then open your start menu > right-click XLaunch shortcut > More > Open file location;

Right-click XLaunch shortcut in the Explorer window > Properties;

Add " -ac" without double quotes right after the closing double quote in the Target field - i.e. for me it was "C:\Program Files\VcXsrv\xlaunch.exe" -ac;

Click ok

Now run Cypress again. Yay! Ran for me :)

like image 200
sobot Avatar answered Jan 19 '23 10:01

sobot