Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cypress hangs on Verifying Cypress can run #7158

Closed
annateng opened this issue Apr 28, 2020 · 14 comments
Closed

Cypress hangs on Verifying Cypress can run #7158

annateng opened this issue Apr 28, 2020 · 14 comments

Comments

@annateng
Copy link

annateng commented Apr 28, 2020

Current behavior:

Installed Cypress through npm and running Cypress from command line for the first time, Cypress hangs on the Verifying Cypress can run step indefinitely:

> bloglist-frontend@0.1.0 cypress:open /mnt/c/users/asus/fullstackopen/part5/bloglist-frontend
> cypress open

It looks like this is your first time using Cypress: 4.4.1

  ⠙  Verifying Cypress can run /home/annateng/.cache/Cypress/4.4.1/Cypress
                                                                                  

Below is the output when running debug: DEBUG=cypress:* npm run cypress:open

cypress:cli:cli cli starts with arguments ["/usr/local/bin/node","/mnt/c/users/asus/fullstackopen/part5/bloglist-frontend/node_modules/.bin/cypress","open"] +0ms
  cypress:cli NODE_OPTIONS is not set +0ms
  cypress:cli:cli program parsing arguments +6ms
  cypress:cli:cli opening Cypress +21ms
  cypress:cli parsed cli options {} +320ms
  cypress:cli opening from options {"project":"/mnt/c/users/asus/fullstackopen/part5/bloglist-frontend"} +0ms
  cypress:cli command line arguments ["--project","/mnt/c/users/asus/fullstackopen/part5/bloglist-frontend"] +0ms
  cypress:cli verifying Cypress app +0ms
  cypress:cli checking environment variables +2ms
  cypress:cli checking if executable exists /home/annateng/.cache/Cypress/4.4.1/Cypress/Cypress +5ms
  cypress:cli Binary is executable? : true +5ms
  cypress:cli binaryDir is  /home/annateng/.cache/Cypress/4.4.1/Cypress +0ms
  cypress:cli Reading binary package.json from: /home/annateng/.cache/Cypress/4.4.1/Cypress/resources/app/package.json +0ms
  cypress:cli Found binary version 4.4.1 installed in: /home/annateng/.cache/Cypress/4.4.1/Cypress +5ms
  cypress:cli could not read binary_state.json file at "/home/annateng/.cache/Cypress/4.4.1/binary_state.json" +24ms
  cypress:cli {} +1ms
  cypress:cli is Verified ? undefined +23ms
  cypress:cli running binary verification check 4.4.1 +1ms
It looks like this is your first time using Cypress: 4.4.1

  cypress:cli clearing out the verified version +6ms
  cypress:cli undefined DISPLAY environment variable +0ms
  cypress:cli Cypress will spawn its own Xvfb +5ms
  cypress:cli needs Xvfb? true +24ms
  cypress:cli Starting Xvfb +6ms
  cypress:cli disabling Electron sandbox +52ms
  cypress:cli running smoke test +1ms
  cypress:cli using Cypress executable /home/annateng/.cache/Cypress/4.4.1/Cypress/Cypress +1ms
  cypress:cli smoke test command: /home/annateng/.cache/Cypress/4.4.1/Cypress/Cypress --no-sandbox --smoke-test --ping=79 +1ms
  cypress:cli smoke test timeout 100000 ms +1ms
  ⠦  Verifying Cypress can run /home/annateng/.cache/Cypress/4.4.1/Cypress

Desired Behavior

Open Cypress

Test code to reproduce

  • Installed Cypress using npm: npm install --save-dev cypress
  • Created custom script in package.json:
    "scripts": { "cypress:open": "cypress open" },
  • Run cypress on CLI: npm run cypress:open

Versions

Cypress 4.4.1
Windows 10 WSL Ubuntu 18.04 LTS
npm 6.14.4

@tspmelo
Copy link

tspmelo commented Apr 29, 2020

This also happened to me once using 4.5.0.
Was not able to reproduce it again.

[16:28:14]  Verifying Cypress can run /home/jenkins-build/build/workspace/ceph-dashboard-pull-requests/build/src/pybind/mgr/dashboard/cypress/4.5.0/Cypress [started]
[16:28:47]  Verifying Cypress can run /home/jenkins-build/build/workspace/ceph-dashboard-pull-requests/build/src/pybind/mgr/dashboard/cypress/4.5.0/Cypress [failed]
Cypress verification timed out.

This command failed with the following output:

/home/jenkins-build/build/workspace/ceph-dashboard-pull-requests/build/src/pybind/mgr/dashboard/cypress/4.5.0/Cypress/Cypress --no-sandbox --smoke-test --ping=986

----------

Command failed: /home/jenkins-build/build/workspace/ceph-dashboard-pull-requests/build/src/pybind/mgr/dashboard/cypress/4.5.0/Cypress/Cypress --no-sandbox --smoke-test --ping=986

----------

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

@annateng
Copy link
Author

For me, I never reach the "Command failed" stage. It simply hangs.

What additional information can I provide?

@Mestru
Copy link

Mestru commented May 4, 2020

Same problem for me running WSL 2 on Windows 10.
I followed steps from here to make it work, maybe someone can reproduce: https://nickymeuleman.netlify.app/blog/gui-on-wsl2-cypress

@annateng
Copy link
Author

Sorry for the late response - Mestru's link fixed it for me. It was a GUI on WSL issue. Thanks Mestru.

@jennifer-shehane jennifer-shehane removed the stage: needs information Not enough info to reproduce the issue label Jul 2, 2020
@thisismydesign
Copy link

thisismydesign commented Jul 27, 2020

@jennifer-shehane Could we have this reopened? I couldn't solve it via that link and either way the command shouldn't hang. It would be great to have an explanation added to the docs about setting up cypress on WSL2.

@thisismydesign
Copy link

Solved it by updating my distro to WSL2. It would be great to mention somewhere in the docs the setup for WSL2.

@jennifer-shehane
Copy link
Member

I created a new issue in our docs to document WSL2 setup here: cypress-io/cypress-documentation#3022. Our documentation is open source and contributions are welcome.

@richworx
Copy link

richworx commented Aug 25, 2020

It looks like this issue was hijacked by WSL2, but the original post was about WSL, not WSL2.
Did anyone ever find a solution for this problem in WSL (1) ? Or is Cypress.io 4+ officially broken on WSL?

Whenever I try to run cypress run or cypress open or cypress verify, the command just hangs at the smoke test.
My X-Win server setup is just fine. I can run other GUI applications (e.g. gitk) and they work perfectly.

System: Windows 10 (10.0.18363.1016) WSL Ubuntu 18.04.3 LTS
cypress verify debug output:

cypress:cli NODE_OPTIONS is not set +0ms
  cypress:cli parsed cli options {} +3ms
  cypress:cli verifying Cypress app +0ms
  cypress:cli checking environment variables +1ms
  cypress:cli checking if executable exists /home/user/.cache/Cypress/4.12.1/Cypress/Cypress +3ms
  cypress:cli Binary is executable? : true +8ms
  cypress:cli binaryDir is  /home/user/.cache/Cypress/4.12.1/Cypress +0ms
  cypress:cli Reading binary package.json from: /home/user/.cache/Cypress/4.12.1/Cypress/resources/app/package.json +0ms
  cypress:cli Found binary version 4.12.1 installed in: /home/user/.cache/Cypress/4.12.1/Cypress +4ms
  cypress:cli could not read binary_state.json file at "/home/user/.cache/Cypress/4.12.1/binary_state.json" +4ms
  cypress:cli {} +0ms
  cypress:cli is Verified ? undefined +1ms
  cypress:cli force verify +0ms
  cypress:cli running binary verification check 4.12.1 +0ms

  cypress:cli clearing out the verified version +5ms
  cypress:cli DISPLAY environment variable is set to localhost:0.0 on Linux
  cypress:cli Assuming this DISPLAY points at working X11 server,
  cypress:cli Cypress will not spawn own Xvfb
  cypress:cli 
  cypress:cli NOTE: if the X11 server is NOT working, Cypress will exit without explanation,
  cypress:cli   see https://github.com/cypress-io/cypress/issues/4034
  cypress:cli Solution: Unset the DISPLAY variable and try again:
  cypress:cli   DISPLAY= npx cypress run ... +0ms
  cypress:cli needs Xvfb? false +10ms
  cypress:cli spawning, should retry on display problem? true +0ms
  cypress:cli disabling Electron sandbox +0ms
  cypress:cli running smoke test +0ms
  cypress:cli using Cypress executable /home/user/.cache/Cypress/4.12.1/Cypress/Cypress +0ms
  cypress:cli smoke test command: /home/user/.cache/Cypress/4.12.1/Cypress/Cypress --no-sandbox --smoke-test --ping=196 +0ms
  cypress:cli smoke test timeout 30000 ms +0ms
  ⠏  Verifying Cypress can run /home/user/.cache/Cypress/4.12.1/Cypress

@valentin-fischer
Copy link

This issue is still present. Any ideas ?

@skflowne
Copy link

Getting it right now on WSL and Cypress 5.2

@valentin-fischer
Copy link

I haven't found any fix for WSL, I ended up installing nodejs and cypress via powershell.

@bilsak18
Copy link

Anyone has a fix for this. I have the same problem concerning WSL 2. Can't run cypress and the cypress:open command simply hangs without throwing any result.

@stahloss
Copy link

I have the same issue with Cypress 4.12.1 after migrating from Jenkins 2.150.2 to 2.235.5 on Openshift with the same slave agent container, based on the following image:

FROM registry.access.redhat.com/openshift3/jenkins-slave-base-rhel7
USER 0:0
# Install NPM & Chrome repository
            RUN curl --silent --location https://rpm.nodesource.com/setup_14.x | bash -

# Install Chrome repository
            ARG CHROME_REPO_SPEC
            RUN printf "%s" "$CHROME_REPO_SPEC" > /etc/yum.repos.d/google-chrome.repo

# Install CentOS repository
            ARG CENTOS_REPO_SPEC
            RUN printf "%s" "$CENTOS_REPO_SPEC" > /etc/yum.repos.d/centos.repo

# Install required packages
            RUN yum install -y python make gcc-c++ xorg-x11-server-Xvfb

# Install NPM + Chrome
            RUN yum install -y google-chrome-stable nodejs && \
            npm config set https-proxy $https_proxy

# Install Cypress missing dependency
            RUN yum install -y libXScrnSaver
USER 1001:0

Output on Jenkins 2.150.2:

It looks like this is your first time using Cypress: 4.12.1

�[?25l[16:20:39]  Verifying Cypress can run /tmp/.cache/Cypress/4.12.1/Cypress [started]
[16:20:41]  Verifying Cypress can run /tmp/.cache/Cypress/4.12.1/Cypress [completed]
�[?25h
Opening Cypress...

And on Jenkins 2.235.5:

It looks like this is your first time using Cypress: 4.12.1

�[?25l[16:14:15]  Verifying Cypress can run /home/jenkins/.cache/Cypress/4.12.1/Cypress [started]

Only difference I see is the location where Cypress is ran from (/tmp/.cache vs /home/jenkins/.cache).
In OP's case, it's also started from the home directory. Could be related?

@stahloss
Copy link

stahloss commented Nov 19, 2020

After adding RUN chmod -R 777 /home/jenkins to my Dockerfile, it works.

Seems that anybody who's having a similar issue on Linux should be able to resolve it like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants