Cypress: Gtk-WARNING **: cannot open display: when cypress is first run from CLI

Created on 29 May 2019  ·  9Comments  ·  Source: cypress-io/cypress

Current behavior:

After directly downloading from the website and running Cypress verify or Cypress version, this message is displayed: Gtk-WARNING **: cannot open display:

Desired behavior:

It seems like cypress is trying to open a GUI, but this should not be necessary. We want to be able to run it via CLI.

Steps to reproduce: (app code and test code)

  1. Direct download from cypress.io
  2. Running Cypress verify

Versions

Cypress : via direct download(should be the latest version)
OS: Debian GNU/Linux 9

Most helpful comment

@PMK try Cypress 3.8.3, there was a fix related to this

All 9 comments

Hey @tomato41, can you paste the DEBUG logs that are printed during cypress verify please? Thanks!

Hey @jennifer-shehane, I get the same message when I try to run it with debug turned on.

@tomato41 Can you print the DEBUG logs here in the issue for us to look at please?

I literally only get (Cypress:57487): Gtk-WARNING **: cannot open display: when I run it with debug turned on. I don't get any logs.

Unfortunately we have to close this issue as there is not enough information to reproduce the problem. This does not mean that your issue is not happening - it just means that we do not have a path to move forward.

Please comment in this issue with a reproducible example and we will reopen the issue. 🙏

@tomato41 FYI I got the same issue than you by launching the docker container.
And "xhost +" solved my issue. Then I could run Cypress.

For me works:
-> change display to 0:0:
export DISPLAY=0:0
-> then:
xhost +
-> set up a display to proper one:
export DISPLAY=$IP:0
-> and launch docker container :)|

I have the same issue inside a Docker container (running on a Mac as the host) and via Kubernetes on Ubuntu. On my mac as the host I do not have xhost command.

Anyone who can help me?

$ DEBUG=cypress:* npx cypress verify
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package x
root@07e5ebbbce4a:~/code# DEBUG=cypress:* npx cypress verify
  cypress:cli:cli cli starts with arguments ["/usr/bin/node","/root/code/node_modules/.bin/cypress","verify"] +0ms
  cypress:cli NODE_OPTIONS is not set +0ms
  cypress:cli:cli program parsing arguments +10ms
  cypress:cli parsed cli options {} +8ms
  cypress:cli verifying Cypress app +0ms
  cypress:cli checking environment variables +4ms
  cypress:cli checking if executable exists /root/.cache/Cypress/3.8.2/Cypress/Cypress +21ms
  cypress:cli Binary is executable? : true +14ms
  cypress:cli binaryDir is  /root/.cache/Cypress/3.8.2/Cypress +7ms
  cypress:cli Reading binary package.json from: /root/.cache/Cypress/3.8.2/Cypress/resources/app/package.json +0ms
  cypress:cli Found binary version 3.8.2 installed in: /root/.cache/Cypress/3.8.2/Cypress +18ms
  cypress:cli could not read binary_state.json file at "/root/.cache/Cypress/3.8.2/binary_state.json" +23ms
  cypress:cli {} +0ms
  cypress:cli is Verified ? undefined +18ms
  cypress:cli force verify +2ms
  cypress:cli running binary verification check 3.8.2 +4ms
  cypress:cli clearing out the verified version +13ms
  cypress:cli undefined DISPLAY environment variable +0ms
  cypress:cli Cypress will spawn its own Xvfb +0ms
  cypress:cli needs Xvfb? true +14ms
  cypress:cli Starting Xvfb +3ms
  cypress:cli disabling Electron sandbox +35ms
  cypress:cli running smoke test +1ms
  cypress:cli using Cypress executable /root/.cache/Cypress/3.8.2/Cypress/Cypress +0ms
  cypress:cli smoke test command: /root/.cache/Cypress/3.8.2/Cypress/Cypress --no-sandbox --smoke-test --ping=810 +1ms
  cypress:cli smoke test timeout 30000 ms +2ms
 ⠹  Verifying Cypress can run /root/.cache/Cypress/3.8.2/Cypress
  cypress:cli Smoke test failed: Error: Command failed: /root/.cache/Cypress/3.8.2/Cypress/Cypress --no-sandbox --smoke-test --ping=810

    at makeError (/root/code/node_modules/cypress/node_modules/execa/index.js:172:9)
    at /root/code/node_modules/cypress/node_modules/execa/index.js:277:16
    at processTicksAndRejections (internal/process/task_queues.js:94:5) {
  code: null,
  stdout: '',
  stderr: '',
  failed: true,
  signal: 'SIGSEGV',
  cmd: '/root/.cache/Cypress/3.8.2/Cypress/Cypress --no-sandbox --smoke-test --ping=810',
  timedOut: false,
  killed: false
} +193ms
  cypress:cli error message: Command failed: /root/.cache/Cypress/3.8.2/Cypress/Cypress --no-sandbox --smoke-test --ping=810

 +2ms
 ✖  Verifying Cypress can run /root/.cache/Cypress/3.8.2/Cypress
   → Cypress Version: 3.8.2
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.

----------

Command failed: /root/.cache/Cypress/3.8.2/Cypress/Cypress --no-sandbox --smoke-test --ping=810

----------

Platform: linux (Ubuntu Linux - 18.04)
Cypress Version: 3.8.2
$ /root/.cache/Cypress/3.8.2/Cypress/Cypress --no-sandbox --smoke-test --ping=631

(Cypress:1699): Gtk-WARNING **: 15:32:48.530: cannot open display:

Is there a missing dependency from the docs what we miss related to Gtk?

@PMK try Cypress 3.8.3, there was a fix related to this

Was this page helpful?
0 / 5 - 0 ratings