I am trying to integrate cypress into our deployment process and I am using one of the your docker images for that (base:8 also tried a chrome one) It runs perfectly on my laptop but when i am deploying to the server it gives this error
up to date in 1.239s
It looks like this is your first time using Cypress: 2.1.0
[21:26:18] Verifying Cypress can run /usr/src/app/node_modules/cypress/dist/Cypress [started]
[21:26:19] Verifying Cypress can run /usr/src/app/node_modules/cypress/dist/Cypress [failed]
[21:26:19] โ 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.
----------
----------
Platform: linux (Debian - 8.10)
Cypress Version: 2.1.0
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.
----------
----------
Platform: linux (Debian - 8.10)
Cypress Version: 2.1.0
I want it to not fail
I am not sure maybe try to run it in a container on a remote server
Hi,
Can you paste your Dockerfile, please? How can it run locally in Docker but fail to run in Docker on CI?
FROM cypress/browsers:chrome65-ff57
# set ARGS
ARG WORK_DIR
ARG COMMANDS_PATH
ARG COMMANDS_FILE
# set workdir
WORKDIR $WORK_DIR
COPY $COMMANDS_PATH $COMMANDS_FILE
RUN chmod +x "$COMMANDS_FILE"
the cypress code is linked with a volume along with the node_modules
and this is the commands_file
#!/bin/bash
npm install
nps run cypress
I was thinking maybe because it'sa remote server i mean with like no gui or anything gjusta server that our website is hosted on
Alright i figured it out turns out i cant run cypress as an entrypoint but need to run it as part of the image
you can close this then :)
but i was wondering why i couldn't run it as an entrypoint?
I don't know why it would not work, but your Dockerfile does not specify it as entrypoint, no?
my docker file is copying the shell file and ansible (as part of the deployment) is running the container with the shell file as an entrypoint
docker_container:
name: cypress
image: "cypress:latest"
state: started
ipc_mode: host
volumes: "{{cypress.volumes}}"
network_mode: host
env:
WORK_DIR: "{{paths.work_dir}}"
entrypoint: "/commands_cypress.sh"
@bahmutov so i faced another problem because i am running the tests on build and not in a container i cant set the ipc to host and my render crashes like mentioned here
https://github.com/cypress-io/cypress/issues/350
is there a way to fix that?
@bahmutov an alternative solution would be to use containers again but apparently there is a dependency that is missing from our remote host if there is a way to know which dependency that would solve everything
any news about this?
It is weird that it is not printing the required dependency, here is what happens in Debian 8.9
$ $(npm bin)/cypress verify
It looks like this is your first time using Cypress: 2.1.0
โ Verifying Cypress can run /home/person/node_modules/cypress/dist/Cypress
โ Cypress Version: 2.1.0
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.
----------
/home/person/node_modules/cypress/dist/Cypress/Cypress: error while loading shared libraries: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory
----------
Platform: linux (Debian - 8.9)
Cypress Version: 2.1.0
I should make an image based on Debian 8.10 to investigate
So I verified that this image based on Debian 8.10 is working
FROM debian:8.10
RUN apt-get update -y
RUN apt-get install -y curl
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get install -y nodejs
RUN node --version
RUN npm --version
RUN apt-get update && \
apt-get install -y \
libgtk2.0-0 \
libnotify-dev \
libgconf-2-4 \
libnss3 \
libxss1 \
libasound2 \
xvfb
RUN npm init -y
RUN npm install cypress
and what you are showing
FROM cypress/browsers:chrome65-ff57
RUN node --version
RUN npm --version
RUN npm init -y
RUN npm install cypress
Please provide the Docker image that is causing the problem so I can recreate the problem in my Docker engine.
i think the problem is the fact that i am running it on a server not on local machine i.e the server might have less dependencies sense it doesn't have any user interface it's just a terminal at the end if you can try it on something similar to this maybe?
also what do you mean provide the docker image isn't the docker file enough?
well, I see on CI you are using "cypress:latest"
- is that the image you build from
FROM cypress/browsers:chrome65-ff57
# set ARGS
ARG WORK_DIR
ARG COMMANDS_PATH
ARG COMMANDS_FILE
# set workdir
WORKDIR $WORK_DIR
COPY $COMMANDS_PATH $COMMANDS_FILE
RUN chmod +x "$COMMANDS_FILE"
? Can you make a repo with ALL arguments (replace environment variables with actual values), please, that I could run in my Docker container - because I have no way to say if anything is wrong by looking at this right now.
@bahmutov i will do that tonight or tomorrow morning max :) thank you!
@bahmutov sorry I couldnt get back to you on this because it was taking too logn and we had other tickets
anyways so i started looking into this again and i tried to run again npx cypress run
but as an interactive shell from inside the container and i am getting this now
npx cypress open
It looks like this is your first time using Cypress: 3.0.2
โ Verifying Cypress can run /root/.cache/Cypress/3.0.2/Cypress
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.0.2/Cypress/Cypress --smoke-test --ping=871
----------
Platform: linux (Debian - 8.10)
Cypress Version: 3.0.2
I have ipc_mode set to host and network_mode as well
and i have volumes for /root/.cache/Cypress/
, node_modules and my app code
also I upgraded the docker image i am usign to cypress/base:10
I'm also facing the same issue:
โ Verifying Cypress can run /root/.cache/Cypress/3.1.0/Cypress
โ Cypress Version: 3.1.0
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.1.0/Cypress/Cypress --smoke-test --ping=280
----------
Platform: linux (Debian - 8.8)
Cypress Version: 3.1.0
Could you please provide a solution to this ?
We're having this issue as well. It was working fine on v3.1.0 for a while, but it's randomly stopped working both locally and on our CI env. Here's the log from me trying to run cypress locally:
$ DEBUG=cypress* node_modules/.bin/cypress verify
cypress:cli cli starts with arguments ["/usr/local/Cellar/node/10.5.0/bin/node","/Users/user/project/node_modules/.bin/cypress","verify"] +0ms
cypress:cli NODE_OPTIONS=--max_old_space_size=8192 +0ms
cypress:cli program parsing arguments +2ms
cypress:cli parsed cli options {} +1ms
cypress:cli verifying Cypress app +0ms
cypress:cli checking environment variables +1ms
cypress:cli checking if executable exists /Users/user/Library/Caches/Cypress/3.1.0/Cypress.app/Contents/MacOS/Cypress +3ms
cypress:cli Binary is executable? : true +1ms
cypress:cli binaryDir is /Users/user/Library/Caches/Cypress/3.1.0/Cypress.app +0ms
cypress:cli Reading binary package.json from: /Users/user/Library/Caches/Cypress/3.1.0/Cypress.app/Contents/Resources/app/package.json +0ms
cypress:cli Found binary version 3.1.0 installed in: /Users/user/Library/Caches/Cypress/3.1.0/Cypress.app +3ms
cypress:cli could not read binary_state.json file +3ms
cypress:cli {} +0ms
cypress:cli is Verified ? undefined +1ms
cypress:cli force verify +0ms
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 +4ms
cypress:cli running smoke test +1ms
cypress:cli using Cypress executable /Users/user/Library/Caches/Cypress/3.1.0/Cypress.app/Contents/MacOS/Cypress +0ms
cypress:cli needs XVFB? false +0ms
cypress:cli smoke test command: /Users/user/Library/Caches/Cypress/3.1.0/Cypress.app/Contents/MacOS/Cypress --smoke-test --ping=920 +0ms
cypress:cli Smoke test failed: { Error: Command failed: /Users/user/Library/Caches/Cypress/3.1.0/Cypress.app/Contents/MacOS/Cypress --smoke-test --ping=920
at makeError (/Users/user/project/node_modules/cypress/node_modules/execa/index.js:172:9)
at Promise.all.then.arr (/Users/user/project/node_modules/cypress/node_modules/execa/index.js:277:16)
at process._tickCallback (internal/process/next_tick.js:68:7)
code: null,
stdout: '',
stderr: '',
failed: true,
signal: 'SIGSEGV',
cmd:
'/Users/user/Library/Caches/Cypress/3.1.0/Cypress.app/Contents/MacOS/Cypress --smoke-test --ping=920',
timedOut: false,
killed: false } +48ms
โ Verifying Cypress can run /Users/user/Library/Caches/Cypress/3.1.0/Cypress.app
โ Cypress Version: 3.1.0
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: /Users/user/Library/Caches/Cypress/3.1.0/Cypress.app/Contents/MacOS/Cypress --smoke-test --ping=920
----------
Platform: darwin (17.5.0)
Cypress Version: 3.1.0
$ npm -v
6.1.0
$ yarn -v
1.7.0
$ node -v
v10.5.0
Running open
and run
don't work either. I've tried uninstalling/reinstalling, doing yarn cache clean
, deleting node_modules and doing a fresh install altogether, even tried installing previous version 3.0.3, but nothing has seemed to get this running again. Is there any workaround or solution for this?
Thank you!
I'm finally able to resolve my issue and now Cypress is working fine for me.
Following environment variable was being set
DISPLAY=:1.5
Unsetting this variable solved my problem. I hope this help someone else as well.
You can verify if you have value set in DISPLAY, by running the following command:
echo $DISPLAY
Not docker related but I fixed this error by unsetting the NODE_OPTIONS
var. https://github.com/cypress-io/cypress/issues/2431#issuecomment-418524647
This workaround did not help for me
I added DISPLAY=:1.5
everywhere I can.
/root/.cache/Cypress/3.1.0/Cypress/Cypress: error while loading shared libraries: libffmpeg.so: cannot open shared object file: No such file or directory
gitlab-ci.yml fragment:
e2e-tests:
image: cypress/base:10
scripts:
- export DISPLAY=:1.5
- DISPLAY=:1.5 CYPRESS_INSTALL_BINARY=http://prx01.infra.rkt/Cypress.zip $(npm bin)/cypress install
- npm run ci:mocks # faked backend background process
- npm run ci:start # dev static server background process
- npm ci && DISPLAY=:1.5 cypress verify && DISPLAY=:1.5 cypress run
versions
having the same issue as well...
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.
----------
/home/circleci/.cache/Cypress/3.1.5/Cypress/Cypress: error while loading shared libraries: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory
----------
Platform: linux (Debian - 8.11)
Cypress Version: 3.1.5
docker:
# specify the version you desire here
- image: circleci/node:10.8.0
- image: circleci/postgres:9.6
environment:
POSTGRES_USER: postgres
POSTGRES_DB: foodnome_dev
- image: redis
- image: cypress/base:10
environment:
TERM: xterm
DISPLAY: 1.5
steps:
- checkout
- restore_cache:
keys:
- v1-deps-{{ .Branch }}-{{ checksum "package.json" }}
- v1-deps-{{ .Branch }}
- v1-deps
- run:
name: Install Dependencies
command: npm install
- save_cache:
key: v1-deps-{{ .Branch }}-{{ checksum "package.json" }}
# cache NPM modules and the folder with the Cypress binary
paths:
- ~/.npm
- ~/.cache
- run: npm run cypress:run
@leogoesger can you try omitting DISPLAY: 1.5
from your configuration? It seems like having DISPLAY
set is interfering with Cypress somehow.
@flotwig I tried that before, and didn't work, and trying something new
Please try unsetting the NODE_OPTIONS
environment variable if you have this set - as this causes Cypress to crash. This is due to an Electron bug prior to version 2.0.3, where having NODE_OPTIONS
set causes either a failure or arguments to be ignored. https://github.com/electron/electron/issues/12695#issuecomment-385826834
printenv
SET
NODE_OPTIONS
environment variableunset NODE_OPTIONS # this is not the same as export NODE_OPTIONS=
set NODE_OPTIONS=
We have open issues for this being fixed that you can follow here:
NODE_OPTIONS
should not exit 0
: https://github.com/cypress-io/cypress/issues/1676 The problem is with how I placed the images for docker. The cypress image needs to be first
@flotwig I tried that before, and didn't work, and trying something new
Can you help me?
I am getting error when I build in bitbucket.
This is my bitbucket-pipelines.yml
image: atlassian/default-image:2
clone:
depth: 1 # include the last commit only
options:
max-time: 5
definitions:
caches:
yarncash-circleci: /home/circleci/.cache/yarn/v4/
#yarncash: /usr/local/share/.cache/yarn/
steps:
- step: &futureCode
name: Test potential future code
image: "circleci/node:8-browsers"
script:
- yarn cache dir
- '[ -z "$BITBUCKET_PR_DESTINATION_BRANCH" ] || (git fetch && git checkout $BITBUCKET_PR_DESTINATION_BRANCH && git merge $BITBUCKET_BRANCH && yarn install && yarn test-ci)'
artifacts:
- test-output/**
- step: &buildAndTest
name: Build and test code
image: "circleci/node:8-browsers"
caches:
- yarncash-circleci
script:
- yarn install
- yarn test-ci
artifacts:
- test-output/**
- build/**
pipelines:
pull-requests:
Qfeature/*:
- step:
name: Test potential future code
caches:
- yarncash-circleci
script:
- echo Testing the potential future code created if merging pull request \#$BITBUCKET_PR_ID from $BITBUCKET_BRANCH into $BITBUCKET_PR_DESTINATION_BRANCH
- git fetch && git checkout $BITBUCKET_PR_DESTINATION_BRANCH && git merge $BITBUCKET_BRANCH
- yarn install
- yarn test-ci
artifacts:
- ./test-output/*
branches:
develop:
- parallel:
- step: *buildAndTest
#- step: *futureCode
- step:
name: Deploy to demo.winenode.com
deployment: staging
script:
- apt-get update && apt-get install -y sshpass
- (echo "develop" && git --no-pager log -n 40 --pretty=format:'%cr [%h] %s' --abbrev-commit) > ./build/build.version
- sshpass -p $WINENODE_KEY ssh -t [email protected] "rm -fr ./demo ; exit"
- sshpass -p $WINENODE_KEY scp -r ./build/ [email protected]:/var/www/winenode.com/demo/
artifacts:
- ./test-output/*
feature/*:
- parallel:
- step: *buildAndTest
#- step: *futureCode
- step:
name: Deploy to testdemo.winenode.com
deployment: test
script:
- apt-get update && apt-get install -y sshpass
- (echo $BITBUCKET_BRANCH && git --no-pager log -n 40 --pretty=format:'%cr [%h] %s' --abbrev-commit) > ./build/build.version
- sshpass -p $WINENODE_KEY ssh -t [email protected] "rm -fr ./testdemo ; exit"
- sshpass -p $WINENODE_KEY scp -r ./build/ [email protected]:/var/www/winenode.com/testdemo/
I am not sure where shall I code related cypress installing.
Please let me know solution.
Thanks
Hi.
I am getting same issue - cypress start is failed
Can you recreate my bitbucket-pipeline.yml?
image: atlassian/default-image:2
clone:
depth: 1 # include the last commit only
options:
max-time: 5
definitions:
caches:
yarncash-circleci: /home/circleci/.cache/yarn/v4/
#yarncash: /usr/local/share/.cache/yarn/
steps:
- step: &futureCode
name: Test potential future code
image: "circleci/node:8-browsers"
script:
- yarn cache dir
- '[ -z "$BITBUCKET_PR_DESTINATION_BRANCH" ] || (git fetch && git checkout $BITBUCKET_PR_DESTINATION_BRANCH && git merge $BITBUCKET_BRANCH && yarn install && yarn test-ci)'
artifacts:
- test-output/**
- step: &buildAndTest
name: Build and test code
image: "circleci/node:8-browsers"
caches:
- yarncash-circleci
script:
- yarn install
- yarn test-ci
artifacts:
- test-output/**
- build/**
pipelines:
pull-requests:
Qfeature/*:
- step:
name: Test potential future code
caches:
- yarncash-circleci
script:
- echo Testing the potential future code created if merging pull request \#$BITBUCKET_PR_ID from $BITBUCKET_BRANCH into $BITBUCKET_PR_DESTINATION_BRANCH
- git fetch && git checkout $BITBUCKET_PR_DESTINATION_BRANCH && git merge $BITBUCKET_BRANCH
- yarn install
- yarn test-ci
artifacts:
- ./test-output/*
branches:
develop:
- parallel:
- step: *buildAndTest
#- step: *futureCode
- step:
name: Deploy to demo.winenode.com
deployment: staging
script:
- apt-get update && apt-get install -y sshpass
- (echo "develop" && git --no-pager log -n 40 --pretty=format:'%cr [%h] %s' --abbrev-commit) > ./build/build.version
- sshpass -p $WINENODE_KEY ssh -t [email protected] "rm -fr ./demo ; exit"
- sshpass -p $WINENODE_KEY scp -r ./build/ [email protected]:/var/www/winenode.com/demo/
artifacts:
- ./test-output/*
feature/*:
- parallel:
- step: *buildAndTest
#- step: *futureCode
- step:
name: Deploy to testdemo.winenode.com
deployment: test
script:
- apt-get update && apt-get install -y sshpass
- (echo $BITBUCKET_BRANCH && git --no-pager log -n 40 --pretty=format:'%cr [%h] %s' --abbrev-commit) > ./build/build.version
- sshpass -p $WINENODE_KEY ssh -t [email protected] "rm -fr ./testdemo ; exit"
- sshpass -p $WINENODE_KEY scp -r ./build/ [email protected]:/var/www/winenode.com/testdemo/
unsetting NODE_OPTIONS has no effect
setting DISPLAY=:1.5 has no effect, too
Currently the whole cypress is useless w/o ability to runing in CI
Running into the same issue as of today, anyone has any workarounds?
In order to better debug the failure to start on Linux, please follow this debugging section https://docs.cypress.io/guides/guides/debugging.html#Run-the-Cypress-app-by-itself
Mostly we want to see if you have any missing dependencies or misconfigured XServer and running the application directly might reveal this.
We will be closing this issue in favor of https://github.com/cypress-io/cypress/issues/4624 in order to direct better focus on the overall problem that is being described in several issues - please add any information about how we can reproduce this bug there. ๐
+1
Most helpful comment
I'm finally able to resolve my issue and now Cypress is working fine for me.
Following environment variable was being set
DISPLAY=:1.5
Unsetting this variable solved my problem. I hope this help someone else as well.
You can verify if you have value set in DISPLAY, by running the following command:
echo $DISPLAY