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

Error Unable to open X display when running Cypress in docker in Interactive mode #395

Closed
WinstonN opened this issue Oct 23, 2020 · 1 comment

Comments

@WinstonN
Copy link

I followed the instructions here: https://www.cypress.io/blog/2019/05/02/run-cypress-with-a-single-docker-command/

When trying to run cypress in in docker, in interactive mode, I get the following error

[16:1023/003758.546489:ERROR:browser_main_loop.cc(1417)] Unable to open X display.

undefined:0


illegal access
(Use `node --trace-uncaught ...` to show where the exception was thrown)

Steps to reproduce

  1. export IP=$(ipconfig getifaddr en0);
  2. /usr/X11/bin/xhost + $IP;
❯❯❯ /usr/X11/bin/xhost + $IP;
192.168.20.10 being added to access control list
DISPLAY=$IP:0
docker run -it \
  -v $PWD:/e2e \
  -v /tmp/.X11-unix:/tmp/.X11-unix \
  -w /e2e \
  -e DISPLAY \
  -e DEBUG=cypress:* \
  --entrypoint cypress \
  cypress/included:5.4.0 open

Error:

❯❯❯ docker run -it \
  -v $PWD:/e2e \
  -v /tmp/.X11-unix:/tmp/.X11-unix \
  -w /e2e \
  -e DISPLAY=$IP:0 \
  -e DEBUG=cypress:* \
  --entrypoint cypress \
  cypress/included:5.4.0 open
  cypress:cli:cli cli starts with arguments ["/usr/local/bin/node","/usr/local/bin/cypress","open"] +0ms
  cypress:cli NODE_OPTIONS is not set +0ms
  cypress:cli:cli program parsing arguments +2ms
  cypress:cli:cli opening Cypress +1ms
  cypress:cli parsed cli options {} +170ms
  cypress:cli opening from options {} +0ms
  cypress:cli command line arguments [] +1ms
  cypress:cli verifying Cypress app +0ms
  cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable +1ms
  cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable +1ms
  cypress:cli using environment variable CYPRESS_CACHE_FOLDER /root/.cache/Cypress +0ms
  cypress:cli checking environment variables +1ms
  cypress:cli checking if executable exists /root/.cache/Cypress/5.4.0/Cypress/Cypress +4ms
  cypress:cli Binary is executable? : true +8ms
  cypress:cli binaryDir is  /root/.cache/Cypress/5.4.0/Cypress +1ms
  cypress:cli Reading binary package.json from: /root/.cache/Cypress/5.4.0/Cypress/resources/app/package.json +13ms
  cypress:cli Found binary version 5.4.0 installed in: /root/.cache/Cypress/5.4.0/Cypress +5ms
  cypress:cli { verified: true } +9ms
  cypress:cli is Verified ? true +5ms
  cypress:cli DISPLAY environment variable is set to 192.168.20.10: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 Using CYPRESS_CACHE_FOLDER from environment variable +24ms
  cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable +0ms
  cypress:cli using environment variable CYPRESS_CACHE_FOLDER /root/.cache/Cypress +2ms
  cypress:cli needs to start own Xvfb? false +0ms
  cypress:cli spawning, should retry on display problem? true +1ms
  cypress:cli passing DISPLAY 192.168.20.10:0 +3ms
  cypress:cli spawning Cypress with executable: /root/.cache/Cypress/5.4.0/Cypress/Cypress +0ms
  cypress:cli spawn args [ '--no-sandbox', '--', '--cwd', '/e2e' ] { detached: false, stdio: 'inherit' } +0ms
  cypress:ts Running without ts-node hook in environment "production" +0ms
  cypress:server:appdata path: /root/.config/Cypress/cy/production/browsers +0ms
  cypress:server:util:node_options NODE_OPTIONS check passed, not forking { NODE_OPTIONS: '--max-http-header-size=1048576' } +0ms
  cypress:server:util:node_options restoring NODE_OPTIONS { NODE_OPTIONS: '--max-http-header-size=1048576', ORIGINAL_NODE_OPTIONS: undefined } +1ms
  cypress:server:cypress starting cypress with argv [ '/root/.cache/Cypress/5.4.0/Cypress/Cypress', '--no-sandbox', '--', '--cwd', '/e2e' ] +0ms
  cypress:server:args argv array: [ '/root/.cache/Cypress/5.4.0/Cypress/Cypress', '--no-sandbox', '--cwd', '/e2e' ] +0ms
  cypress:server:args argv parsed: { _: [ '/root/.cache/Cypress/5.4.0/Cypress/Cypress' ], sandbox: false, cwd: '/e2e', invokedFromCli: true } +3ms
  cypress:server:util:proxy found proxy environment variables {} +0ms
  cypress:server:args options { _: [ '/root/.cache/Cypress/5.4.0/Cypress/Cypress' ], sandbox: false, cwd: '/e2e', invokedFromCli: true, config: {} } +1ms
  cypress:server:args argv options: { _: [ '/root/.cache/Cypress/5.4.0/Cypress/Cypress' ], sandbox: false, cwd: '/e2e', invokedFromCli: true, config: {} } +1ms
  cypress:server:cypress from argv [ '/root/.cache/Cypress/5.4.0/Cypress/Cypress', '--no-sandbox', '--cwd', '/e2e' ] got options { _: [ '/root/.cache/Cypress/5.4.0/Cypress/Cypress' ], sandbox: false, cwd: '/e2e', invokedFromCli: true, config: {} } +6ms
[16:1023/003155.368363:ERROR:browser_main_loop.cc(1417)] Unable to open X display.

undefined:0


illegal access
(Use `node --trace-uncaught ...` to show where the exception was thrown)
  cypress:cli child event fired { event: 'exit', code: 7, signal: null } +2s
  cypress:cli child event fired { event: 'close', code: 7, signal: null } +1ms

Do you know what I am doing wrong here?
I'm running this on a Mac

@WinstonN
Copy link
Author

Found it, make sure the below boxes are ticket
image

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

No branches or pull requests

1 participant