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 verify step #819

Closed
Hipska opened this issue Oct 26, 2017 · 83 comments · Fixed by #4080
Closed

Cypress hangs on verify step #819

Hipska opened this issue Oct 26, 2017 · 83 comments · Fixed by #4080
Assignees
Labels
CI General issues involving running in a CI provider cli OS: linux type: bug

Comments

@Hipska
Copy link

Hipska commented Oct 26, 2017

Current behavior:

Cypress keeps "Verifying Cypress can run", so the program hangs

Desired behavior:

Cypress to run normally

How to reproduce:

npm install cypress mocha mocha-multi-reporters mocha-junit-reporter
node_modules/cypress/bin/cypress verify

Additional Info (images, stack traces, etc)

No, are there log files somewhere?

Cypress team update

If you hit problems running Cypress on a specific system:

  • try using newer Cypress version

  • try using newer CI version, or a different CI. See our examples for different CI systems that we run already in cypress-example-kitchensink for examples of systems that work very well

  • try using our official images from cypress-io/cypress-docker-images

  • run Cypress with debug log output. In particular, we would like to see debug output from the CLI module and from our XVFB module. You can turn them both using DEBUG=cypress:cli,xvfb npx cypress verify

  • provide an example for us to reproduce, and please remember that it will be hard for us to install an entire system that matches your system unless you provide Docker file

  • Operating System: CentOS 7.4

  • Cypress Version: 1.0.2

  • Browser Version: N/A

@bahmutov
Copy link
Contributor

Can you run verify step with DEBUG=cypress:* environment variable so we see debug log messages, please?

@Hipska
Copy link
Author

Hipska commented Oct 26, 2017

Not much more to see:

  cypress:cli cli starts with arguments ["/usr/bin/node","/opt/webtest/node_modules/cypress/bin/cypress","verify"] +0ms
  cypress:cli verifying Cypress app +202ms
  cypress:cli path to info.json file /opt/webtest/node_modules/cypress/dist/info.json +3ms
  cypress:cli { version: '1.0.2', verifiedVersion: null } +6ms
  cypress:cli installed version is 1.0.2 comparing to 1.0.2 +4ms
  cypress:cli checking if executable exists /opt/webtest/node_modules/cypress/dist/Cypress/Cypress +0ms
  cypress:cli path to info.json file /opt/webtest/node_modules/cypress/dist/info.json +1ms
  cypress:cli has verified version null +1ms
  cypress:cli run verification check? true +0ms
  cypress:cli running binary verification check 1.0.2 +1ms
It looks like this is your first time using Cypress: 1.0.2

  cypress:cli writing verified version string "null" +6ms
  cypress:cli path to info.json file /opt/webtest/node_modules/cypress/dist/info.json +0ms
  cypress:cli path to info.json file /opt/webtest/node_modules/cypress/dist/info.json +1ms
  cypress:cli running smoke test +6ms
  cypress:cli using Cypress executable /opt/webtest/node_modules/cypress/dist/Cypress/Cypress +0ms
  cypress:cli needs XVFB? true +0ms
  cypress:cli Starting XVFB +1ms
 ⠏  Verifying Cypress can run /opt/webtest/node_modules/cypress/dist/Cypress

Note that the icon keeps spinning, so it is not completely frozen..

@jennifer-shehane jennifer-shehane added OS: linux cli stage: needs investigating Someone from Cypress needs to look at this labels Oct 26, 2017
@marchys
Copy link

marchys commented Oct 27, 2017

Not sure if same problem but the same happens

One issue I had during installation is that I could not find libsound package and I had to install libsound2

Operating System: Ubuntu 16.04.3 LTS (under windows 10)
Cypress Version: 1.0.2

  cypress:cli cli starts with arguments ["/root/.nvm/versions/node/v8.8.1/bin/node","/mnt/c/git/test-cypress/node_modules/cypress/bin/cypress","verify"] +0ms
  cypress:cli verifying Cypress app +205ms
  cypress:cli path to info.json file /mnt/c/git/test-cypress/node_modules/cypress/dist/info.json +1ms
  cypress:cli { version: '1.0.2', verifiedVersion: null } +14ms
  cypress:cli installed version is 1.0.2 comparing to 1.0.2 +2ms
  cypress:cli checking if executable exists /mnt/c/git/test-cypress/node_modules/cypress/dist/Cypress/Cypress +0ms
  cypress:cli path to info.json file /mnt/c/git/test-cypress/node_modules/cypress/dist/info.json +1ms
  cypress:cli has verified version null +1ms
  cypress:cli run verification check? true +0ms
  cypress:cli running binary verification check 1.0.2 +0ms
It looks like this is your first time using Cypress: 1.0.2

  cypress:cli writing verified version string "null" +3ms
  cypress:cli path to info.json file /mnt/c/git/test-cypress/node_modules/cypress/dist/info.json +0ms
  cypress:cli path to info.json file /mnt/c/git/test-cypress/node_modules/cypress/dist/info.json +1ms
  cypress:cli running smoke test +4ms
  cypress:cli using Cypress executable /mnt/c/git/test-cypress/node_modules/cypress/dist/Cypress/Cypress +0ms
  cypress:cli needs XVFB? true +0ms
  cypress:cli Starting XVFB +0ms
  cypress:cli smoke test command: /mnt/c/git/test-cypress/node_modules/cypress/dist/Cypress/Cypress --smoke-test --ping=390 +62ms
 ⠙  Verifying Cypress can run /mnt/c/git/test-cypress/node_modules/cypress/dist/Cypress```

@jennifer-shehane
Copy link
Member

The docs have been updated to specify libsound2 instead of libsound package now: https://on.cypress.io/continuous-integration#Dependencies

@Hipska
Copy link
Author

Hipska commented Nov 2, 2017

@jennifer-shehane Does that have anything to do with these bug reports?

P.S. libasound.so.2 is installed on my system.

@bahmutov
Copy link
Contributor

bahmutov commented Nov 2, 2017

@Hipska what happens if you just install cypress and then start adding dependencies one by one to see which one breaks?

npm i cypress
$(npm bin)/cypress verify
npm i mocha
$(npm bin)/cypress verify
npm i mocha-multi-reporters
$(npm bin)/cypress verify
npm i mocha-junit-reporter
$(npm bin)/cypress verify

@Hipska
Copy link
Author

Hipska commented Nov 2, 2017

The second line already keeps Cypress hanging. So only installing Cypress already breaks.

@bahmutov
Copy link
Contributor

bahmutov commented Nov 2, 2017

so if I run

npm i cypress
$(npm bin)/cypress verify

on CentOS 7.4 it is hanging, right? I am just trying to confirm the smallest reproduction steps

@Hipska
Copy link
Author

Hipska commented Nov 2, 2017

Yup exactly, and apparently on Ubuntu 16.04.3 as well.

@bahmutov
Copy link
Contributor

bahmutov commented Nov 2, 2017

@Hipska I made a (larger than necessary) Docker image based on Centos7 cypress/base:centos7 if you want to give this a spin. The dockerfile with dependencies I had to install there is https://github.com/cypress-io/cypress-docker-images/blob/centos7/Dockerfile

See if these dependencies / image solves your problem

@sawasawasawa
Copy link

sawasawasawa commented Jan 14, 2018

Hi, any updates on this issue? I can't manage to run tests on Jenkins, although locally everything is working perfectly. Tried the above mentioned build as well, got same result:

It looks like this is your first time using Cypress: 1.4.1 [00:08:19] 

Verifying Cypress can run /var/lib/jenkins/workspace/st_addCypress-docker-centos-CCQQYACIT2KYV7T2RMNHRIYTIIIJXPZF2NFPS76PZKAIDRAPJLFA/node_modules/cypress/dist/Cypress [started]
[00:22:59]  Verifying Cypress can run /var/lib/jenkins/workspace/st_addCypress-docker-centos-CCQQYACIT2KYV7T2RMNHRIYTIIIJXPZF2NFPS76PZKAIDRAPJLFA@2/node_modules/cypress/dist/Cypress [started]

2018-01-14T00:22:59.450Z cypress:cli writing verified version string "null"

2018-01-14T00:22:59.451Z cypress:cli path to info.json file /var/lib/jenkins/workspace/st_addCypress-docker-centos-CCQQYACIT2KYV7T2RMNHRIYTIIIJXPZF2NFPS76PZKAIDRAPJLFA@2/node_modules/cypress/dist/info.json

2018-01-14T00:22:59.451Z cypress:cli path to info.json file /var/lib/jenkins/workspace/st_addCypress-docker-centos-CCQQYACIT2KYV7T2RMNHRIYTIIIJXPZF2NFPS76PZKAIDRAPJLFA@2/node_modules/cypress/dist/info.json

2018-01-14T00:22:59.455Z cypress:cli running smoke test

2018-01-14T00:22:59.455Z cypress:cli using Cypress executable /var/lib/jenkins/workspace/st_addCypress-docker-centos-CCQQYACIT2KYV7T2RMNHRIYTIIIJXPZF2NFPS76PZKAIDRAPJLFA@2/node_modules/cypress/dist/Cypress/Cypress

2018-01-14T00:22:59.455Z cypress:cli needs XVFB? true

2018-01-14T00:22:59.455Z cypress:cli Starting XVFB

2018-01-14T00:22:59.509Z cypress:cli smoke test command: /var/lib/jenkins/workspace/st_addCypress-docker-centos-CCQQYACIT2KYV7T2RMNHRIYTIIIJXPZF2NFPS76PZKAIDRAPJLFA@2/node_modules/cypress/dist/Cypress/Cypress --smoke-test --ping=11

I tried also running explicitly xvfb-run -a -s "-screen 0 1280x1024x24" {path to Cypress} --run-project={path to project} and get:

Xlib:  extension "RANDR" missing on display ":99".
A JavaScript error occurred in the main process
Uncaught Exception:
Error: Path must be absolute
    at Error (native)
    at Object.<anonymous> (/projectpath/node_modules/cypress/dist/Cypress/resources/electron.asar/browser/init.js:150:5)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.runMain (module.js:590:10)
    at run (bootstrap_node.js:402:7)
    at startup (bootstrap_node.js:157:9)
Xlib:  extension "RANDR" missing on display ":99".
libudev: udev_has_devtmpfs: name_to_handle_at on /dev: Operation not permitted

@bramsierag
Copy link

hi @bahmutov, tried the docker image and didn't solved the issue. when i ran DEBUG='cypress:* ./node_modules/cypress/bin/cypress verify it still hangs on the smoke test command.
Any updates on this issue? anyone :)

@floriansimon1
Copy link

I'm having the same problem running the Docker image. Let me know if I can give valuable info.

@floriansimon1
Copy link

Is there any update regarding this problem?

@brian-mann
Copy link
Member

Are we talking about it hanging only in CentOS?

@floriansimon1 which docker image are you running?

@bramsierag which docker image are you running?

@floriansimon1
Copy link

cypress/base:8

@bramsierag
Copy link

cypress/base:centos7

@brian-mann
Copy link
Member

brian-mann commented Feb 19, 2018

@floriansimon1 okay it sounds like then you're having a problem running in Ubuntu. Honestly, I have no idea - we have so many users using this image, and we internally use it across many different services - local docker in OSX, multiple CI providers - I can't imagine what could not be working with yours. Perhaps it's something to do with your Docker configuration. I would say simplify everything - get rid of your docker configuration and just try to get Cypress up and running by itself. From there start adding in things until it stops working. Run locally too, not in CI. Remove everything that's your own configuration and start with the image by itself. Mount it locally and run it.

@bramsierag let me see if we can get some 👀 into this. @bkucera do you mind taking the lead on this one? @bramsierag is saying the verification stage of Cypress is failing on our docker centos image. Can you reproduce locally and then I'll help you take a look at it. Thanks.

@Hipska
Copy link
Author

Hipska commented Feb 20, 2018

It might help if the verify step would output some debug info instead of just “doing stuff”.

@floriansimon1
Copy link

floriansimon1 commented Feb 20, 2018

@brian-mann: thanks for your answer. If it helps, the image works locally. It only fails on my Jenkins server. I tried using the CentOS image on Jenkins, and I got the same results. It might be due to the Jenkins Docker config, but I don't have the liberty/knowledge to change it unfortunately, so I'll wait for the Cypress team to fix @bramsierag's problem and update, hoping that it will resolve my problem as well.

I guess I'll have to disable the test suite on the CI server for now :-/

EDIT: My version of Docker on Jenkins is Docker version 17.12, and I have 17.05 locally.

@kuceb
Copy link
Contributor

kuceb commented Feb 21, 2018

@bramsierag where are you running your docker image? I am not having any errors with any of the docker images with any Cypress versions running docker locally(on Linux) , it would be helpful to know your CI provider

@bramsierag
Copy link

Hi Bkucera, appreciate the effort. Locally on osx no problem, only with Jenkins on centos7. Docker version local and on centos is 17.12

@kuceb
Copy link
Contributor

kuceb commented Feb 21, 2018

@bramsierag alright, looks like I'm gonna have to spin up Docker inside Jenkins inside Docker to see whats going on

@floriansimon1
Copy link

floriansimon1 commented Feb 26, 2018

I just reran the tests with debug mode and it seems that it also hangs on the smoke-test line. The difference is that I have the following:

2018-02-26T10:30:39.601Z cypress:cli using Cypress executable /foobar/workspace/node_modules/cypress/dist/Cypress/Cypress
2018-02-26T10:30:39.601Z cypress:cli needs XVFB? true
2018-02-26T10:30:39.601Z cypress:cli Starting XVFB
2018-02-26T10:30:39.644Z cypress:xvfb _XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created.

@Renaud009
Copy link

Having same issue on Ubuntu 16.04.5 LTS (WSL on windows 10)

@jennifer-shehane jennifer-shehane added stage: needs information Not enough info to reproduce the issue and removed stage: needs investigating Someone from Cypress needs to look at this labels Dec 4, 2018
@derkoe
Copy link

derkoe commented Jan 15, 2019

We had the same problem - the reason was that "$HOME/.config" was mounted into the container read-only. So the solution was to mount the relevant stuff into another directory and then copy it over before the build.

Would be great when Cypress would not wait/hang when a file cannot be written.

@jennifer-shehane jennifer-shehane removed stage: needs information Not enough info to reproduce the issue labels Jan 16, 2019
@linuxdropout
Copy link

Same issue

Windows 10
WSL - Ubuntu 18.04.1 LTS (Bionic Beaver)
Cypress - ^3.1.5

Steps:
npm i
node node_modules/cypress/bin/cypress open

Result: never finishes 'Verifying cypress can run'

@teamfphl
Copy link

In case it helps anyone: we had this issue with the cypress base image. But, we had environment variable NODE_OPTIONS="--max_old_space_size=2000" set for node set in our CI. Removing this environment variable while cypress was running solved the problem.

@stuartsan
Copy link

stuartsan commented Mar 21, 2019

I ran into this same problem of Cypress hanging on the verify step.

The call to util.exec is where I observed it hanging:

return Promise.resolve(util.exec(cypressExecPath, args))
.catch(onSmokeTestError)
.then((result) => {
const smokeTestReturned = result.stdout

If I change that first line to:

return Promise.resolve(util.exec(cypressExecPath, args, { stdio: 'inherit' })) 

So that the child process dumps its stdout and stderr to those of the parent process, it still hangs but I get an informative error message:

A JavaScript error occurred in the main process
Uncaught Exception:
Error: Failed to get 'appData' path
    at Object.<anonymous> (/tmp/lib/resources/electron.asar/browser/init.js:149:39)
    at Object.<anonymous> (/tmp/lib/resources/electron.asar/browser/init.js:173:3)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Function.Module.runMain (module.js:605:10)
    at startup (bootstrap_node.js:167:16)
    at bootstrap_node.js:589:3

Which I was able to use to trace back to the problem (same as @derkoe 's -- electron's default appData path was a read-only directory).

Y'all open to a PR to add this? Doesn't address the underlying issue of why cypress --smoke-test seems to be not exiting when this kind of failure happens, but it at least adds visibility so folks can self-serve and fix their specific problem more easily.

EDIT would need to adjust things a little so the then and catch callbacks don't blow up with the difference when the smoke test does exit -- more like "y'all open to something along these lines"

@Hipska
Copy link
Author

Hipska commented Mar 21, 2019

Finally some progress on this ticket 👍

@jennifer-shehane
Copy link
Member

@stuartsan Yes, we're definitely open to PRs for this - hanging with zero errors is the absolute worst experience Cypress can give. Any improvement on this is gladly welcomed.

Feel free to open WIP PRs if you don't know how to implement and test it all also. https://github.com/cypress-io/cypress/blob/develop/CONTRIBUTING.md#writing-code

@Hipska
Copy link
Author

Hipska commented Mar 22, 2019

Can this issue then be reopened please?

@stuartsan
Copy link

@jennifer-shehane cool, thanks. Just sent a PR: #3807

@sebastianheise
Copy link

While not actually testing the above PR, it did give the crucial tip to check for permissions on ~/.config/. So this solved my cypress verify issue.
More debug info === more good ;)

@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review stage: pending release labels May 1, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented May 2, 2019

The code for this is done in cypress-io/cypress#4080, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot cypress-bot bot removed the stage: needs review The PR code is done & tested, needs review label May 2, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented May 17, 2019

Released in 3.3.0.

@justinstander
Copy link

Hi everyone!.

I tried everything I could find on the Internet to solve this issue. Spent 2 days exhausting all the suggested fixes I found. It boiled down to WSL 2, which required me to install a pre-release of Win 10 on my machine after enrolling in the insider program.

This worked for me:

  1. Register for the insider program: https://insider.windows.com/en-us/
  2. I made sure that windows update had picked up the latest WSL 2 compatible build of Win 10. Go to windows update and check for updates, verify that the build number being installed is one that will work with WSL 2.0. The build has to be win 10 build 18917 or greater.
  3. Install WSL 2.0: https://docs.microsoft.com/en-us/windows/wsl/wsl2-install

Note: The legacy Ubuntu distro does not work with WSL 2.0. I added Ubuntu 18.04 through the Windows Store during Step 2.

jstander@DESKTOP-4UO32GL:/mnt/c/dev17/...$  lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.4 LTS
Release:        18.04
Codename:       bionic
jstander@DESKTOP-4UO32GL:/mnt/c/dev17/...$ yarn cypress verify
yarn run v1.22.4
$ /mnt/c/dev17/.../node_modules/.bin/cypress verify

  ✔  Verified Cypress! /home/jstander/.cache/Cypress/4.5.0/Cypress
Done in 15.14s.
jstander@DESKTOP-4UO32GL:/mnt/c/dev17/...$

@snaix93
Copy link

snaix93 commented May 14, 2020

@justinstander Your solution is working.... :) It's very tricky to install everything but after wasting half of the day to fix this "verification" issue I've made it working on my windows with ubuntu 18.4 and wsl2. Would be faster to install an ubuntu system and install the project there to see how this will work on CI instead of trying to fix this issue.... :)

@single-stop-justin
Copy link

@snaix93 So glad! It is a little tricky... and time consuming.

One other thing, to use Linux GUIs, like the Cypress GUI, you'll need a Windows X Server. I am using VcXsrv: https://sourceforge.net/projects/vcxsrv/

@kanjieater
Copy link

  cypress:cli:cli cli starts with arguments ["/home/ke/.nvm/versions/node/v13.14.0/bin/node","/a/code/ComicEater/node_modules/.bin/cypress","verify"] +0ms
  cypress:cli NODE_OPTIONS is not set +0ms
  cypress:cli:cli program parsing arguments +1ms
  cypress:cli parsed cli options {} +1ms
  cypress:cli verifying Cypress app +0ms
  cypress:cli checking environment variables +1ms
  cypress:cli checking if executable exists /home/ke/.cache/Cypress/4.5.0/Cypress/Cypress +2ms
  cypress:cli Binary is executable? : true +1ms
  cypress:cli binaryDir is  /home/ke/.cache/Cypress/4.5.0/Cypress +1ms
  cypress:cli Reading binary package.json from: /home/ke/.cache/Cypress/4.5.0/Cypress/resources/app/package.json +0ms
  cypress:cli Found binary version 4.5.0 installed in: /home/ke/.cache/Cypress/4.5.0/Cypress +2ms
  cypress:cli could not read binary_state.json file at "/home/ke/.cache/Cypress/4.5.0/binary_state.json" +3ms
  cypress:cli {} +0ms
  cypress:cli is Verified ? undefined +1ms
  cypress:cli force verify +0ms
  cypress:cli running binary verification check 4.5.0 +0ms

  cypress:cli clearing out the verified version +3ms
  cypress:cli DISPLAY environment variable is set to localhost: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 +8ms
  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/ke/.cache/Cypress/4.5.0/Cypress/Cypress +0ms
  cypress:cli smoke test command: /home/ke/.cache/Cypress/4.5.0/Cypress/Cypress --no-sandbox --smoke-test --ping=886 +0ms
  cypress:cli smoke test timeout 30000 ms +0ms
  ⠸  Verifying Cypress can run /home/ke/.cache/Cypre
ss/4.5.0/Cypress

I can use other electron apps just fine on WSL1 and X410. WSL2 isn't officially released yet so I'm not ready to move to it yet, and won't be deprecated anytime soon. Can this be reopened?

@jennifer-shehane jennifer-shehane added CI General issues involving running in a CI provider and removed CI: jenkins labels Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI General issues involving running in a CI provider cli OS: linux type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.