cypress: Cypress hangs on verify step

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

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 12
  • Comments: 83 (22 by maintainers)

Most upvoted comments

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’

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

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

https://github.com/cypress-io/cypress/blob/2333d04a54acfd2d89d9d53cc60a49d46228ceef/cli/lib/tasks/verify.js#L68-L71

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”

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.

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

Hello everyone, Im having similar problem on Ubuntu (WSL on windows 10)

adduser@Magus:/mnt/c/Users/Illya/projects/haha-studio$ DEBUG=cypress:* cypress run
  cypress:cli cli starts with arguments ["/usr/bin/node","/usr/bin/cypress","run"] +0ms
  cypress:cli NODE_OPTIONS is not set +0ms
  cypress:cli program parsing arguments +9ms
  cypress:cli running Cypress +3ms
  cypress:cli parsed cli options {} +439ms
  cypress:cli verifying Cypress app +0ms
  cypress:cli checking environment variables +4ms
  cypress:cli checking if executable exists /home/adduser/.cache/Cypress/3.1.1/Cypress/Cypress +82ms
  cypress:cli Binary is executable? : true +56ms
  cypress:cli binaryDir is  /home/adduser/.cache/Cypress/3.1.1/Cypress +5ms
  cypress:cli Reading binary package.json from: /home/adduser/.cache/Cypress/3.1.1/Cypress/resources/app/package.json +0ms
  cypress:cli Found binary version 3.1.1 installed in: /home/adduser/.cache/Cypress/3.1.1/Cypress +15ms
  cypress:cli could not read binary_state.json file +18ms
  cypress:cli {} +1ms
  cypress:cli is Verified ? undefined +9ms
  cypress:cli running binary verification check 3.1.1 +1ms
It looks like this is your first time using Cypress: 3.1.1

  cypress:cli clearing out the verified version +15ms
  cypress:cli running smoke test +8ms
  cypress:cli using Cypress executable /home/adduser/.cache/Cypress/3.1.1/Cypress/Cypress +1ms
  cypress:cli needs XVFB? true +1ms
  cypress:cli Starting XVFB +0ms
 ⠏  Verifying Cypress can run /home/adduser/.cache/Cypress/3.1.1/Cypress
 ⠼  Verifying Cypress can run /home/adduser/.cache/Cypress/3.1.1/Cypress

Finally found a solution!

My setup is similar to @paulmoliva.

Jenkins declarative pipeline ends up running docker like this:

docker run -t -d -u ***:*** -w /var/lib/jenkins/workspace/<JOB> -v /var/lib/jenkins/workspace/<JOB>:/var/lib/jenkins/workspace/<JOB>:rw,z -v /var/lib/jenkins/workspace/<JOB>@tmp:/var/lib/jenkins/workspace/<JOB>@tmp:rw,z -e ******** ... cypress/base:8 cat

Turns out that workspace is correct, but inside container home location is /, and every file write happens to host’s / (Jenkins root).

Then in our specific case, electron cannot write to home location, and Cypress’s smoke test crashes in hang.

The solution is to provide an HOME environment variable to docker, then all processes that uses home location reads/writes to the correct path:

agent {
  docker {
    image 'cypress/base:8'
    args '-e HOME=${workspace}'
  }
}

Note: For me args worked only with single quotes, maybe it runs a lazy evaluation instead of double quotes.

Note: With this solution I was also able to replace cypress/base:centos7 with cypress/base:8 image

I know this can be frustrating, but please try to refrain from making any such witty comments. The Cypress team does not owe us anything. If you aren’t happy with the fact that this isn’t getting anywhere, why don’t you just try to find a fix yourself? OSS needs your contributions, it’s not just a shop for software that is free of charge.

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/...$

Hey guys, I’m facing the same issue on Ubuntu (WSL on windows 10) when running cypress for a first time. Any ideas? I already installed all cypress required dependencies.

LOG from DEBUG=cypress:* cypress run

  cypress:cli cli starts with arguments ["/usr/bin/node","/home/fecruzb/codes/my-project/node_modules/.bin/cypress","run"] +0ms
  cypress:cli NODE_OPTIONS is not set +0ms
  cypress:cli program parsing arguments +6ms
  cypress:cli running Cypress +1ms
  cypress:cli parsed cli options {} +84ms
  cypress:cli verifying Cypress app +0ms
  cypress:cli checking environment variables +1ms
  cypress:cli checking if executable exists /home/fecruzb/.cache/Cypress/3.1.0/Cypress/Cypress +5ms
  cypress:cli Binary is executable? : true +10ms
  cypress:cli binaryDir is  /home/fecruzb/.cache/Cypress/3.1.0/Cypress +1ms
  cypress:cli Reading binary package.json from: /home/fecruzb/.cache/Cypress/3.1.0/Cypress/resources/app/package.json +0ms
  cypress:cli Found binary version 3.1.0 installed in: /home/fecruzb/.cache/Cypress/3.1.0/Cypress +5ms
  cypress:cli could not read binary_state.json file +5ms
  cypress:cli {} +1ms
  cypress:cli is Verified ? undefined +2ms
  cypress:cli running binary verification check 3.1.0 +0ms
It looks like this is your first time using Cypress: 3.1.0

  cypress:cli clearing out the verified version +6ms
  cypress:cli running smoke test +2ms
  cypress:cli using Cypress executable /home/fecruzb/.cache/Cypress/3.1.0/Cypress/Cypress +0ms
  cypress:cli needs XVFB? true +0ms
  cypress:cli Starting XVFB +0ms
 ⠹  Verifying Cypress can run /home/fecruzb/.cache/Cypress/3.1.0/Cypress
 ⠧  Verifying Cypress can run /home/fecruzb/.cache/Cypress/3.1.0/Cypress
  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?

Finally some progress on this ticket 👍

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```

Released in 3.3.0.

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.

Can this issue then be reopened please?

Got it, we’re running in OpenShift Enterprise which adds a bunch of other problems into the mix.

For anyone else who encounters such issues when trying to run a Centos-7-based image in OpenShift, we ended up finding this plugin for Jenkins, and now we just spin up an image based on the default Cypress images:

podTemplate(label: label, cloud: 'openshift', containers: [
    containerTemplate(
      name: 'cypress',
      image: 'cypress/browsers:chrome67',
      ttyEnabled: true,
      command: 'cat',
      resourceRequestCpu: '200m',
      resourceLimitCpu: '300m',
      resourceRequestMemory: '500m',
      resourceLimitMemory: '2Gi',
    )
  ]) {

    node(label) {
        stage('Cypress Tests') {
            git url: 'https://github.com/****.git',
                branch: 'master',
                credentialsId: '***********'
            container('cypress') {
                stage('Install dependencies') {
                  sh 'npm install'
                }
                stage('Run Presentation Tests') {
                  sh 'npm run presentational-tests'
                }
            }
        }

    }
}

The root problem (the permissions thing) just kind of went away when we use the default images. Could have something to do with Centos, idk. We were using Centos because we were basing our image off one which included JNLP, but that does not seem necessary with the plugin.

😄 I was just accidentally @mentioned. No need to include me

No nothing new, it looks like they are ignoring my and others issue. So I’m ignoring Cypress as well and moved to other tools.

Is there any update regarding this problem?

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