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

Dependencies missing while using your docker image #1556

Closed
omaressameldin opened this issue Apr 9, 2018 · 33 comments
Closed

Dependencies missing while using your docker image #1556

omaressameldin opened this issue Apr 9, 2018 · 33 comments
Assignees

Comments

@omaressameldin
Copy link

omaressameldin commented Apr 9, 2018

Current behavior:

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

Desired behavior:

I want it to not fail

How to reproduce:

I am not sure maybe try to run it in a container on a remote server

  • Operating System: ubuntu 14.04
  • Cypress Version: 2.1.0
  • Browser Version: headless
@bahmutov
Copy link
Contributor

bahmutov commented Apr 9, 2018

Hi,

Can you paste your Dockerfile, please? How can it run locally in Docker but fail to run in Docker on CI?

@omaressameldin
Copy link
Author

omaressameldin commented Apr 9, 2018

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

@omaressameldin
Copy link
Author

omaressameldin commented Apr 9, 2018

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?

@bahmutov
Copy link
Contributor

bahmutov commented Apr 9, 2018

I don't know why it would not work, but your Dockerfile does not specify it as entrypoint, no?

@omaressameldin
Copy link
Author

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"

@omaressameldin
Copy link
Author

@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
#350
is there a way to fix that?

@omaressameldin
Copy link
Author

@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

@jennifer-shehane jennifer-shehane added the stage: needs investigating Someone from Cypress needs to look at this label Apr 11, 2018
@omaressameldin
Copy link
Author

any news about this?

@bahmutov
Copy link
Contributor

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

@bahmutov
Copy link
Contributor

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.

@omaressameldin
Copy link
Author

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?

@bahmutov
Copy link
Contributor

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 bahmutov self-assigned this Apr 19, 2018
@omaressameldin
Copy link
Author

@bahmutov i will do that tonight or tomorrow morning max :) thank you!

@omaressameldin
Copy link
Author

omaressameldin commented Jul 17, 2018

@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

@jaideeprana
Copy link

jaideeprana commented Aug 27, 2018

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 ?

@maureenwaggl
Copy link

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!

@jaideeprana
Copy link

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

@carloscheddar
Copy link

Not docker related but I fixed this error by unsetting the NODE_OPTIONS var. #2431 (comment)

@a-x-
Copy link

a-x- commented Feb 15, 2019

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

  • "cypress": "3.1.0",
  • latest enterprise gitlab
  • cypress/base:10

@leogoesger
Copy link

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

@leogoesger
Copy link

leogoesger commented Feb 20, 2019

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

@flotwig
Copy link
Contributor

flotwig commented Feb 20, 2019

@leogoesger can you try omitting DISPLAY: 1.5 from your configuration? It seems like having DISPLAY set is interfering with Cypress somehow.

@leogoesger
Copy link

@flotwig I tried that before, and didn't work, and trying something new

@jennifer-shehane
Copy link
Member

jennifer-shehane commented Mar 8, 2019

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. electron/electron#12695 (comment)

To see all environment variables currently set

MacOS / Linux

printenv

Windows

SET

To unset NODE_OPTIONS environment variable

MacOS / Linux

unset NODE_OPTIONS # this is not the same as export NODE_OPTIONS=

Windows

set NODE_OPTIONS=

We have open issues for this being fixed that you can follow here:

@leogoesger
Copy link

The problem is with how I placed the images for docker. The cypress image needs to be first

@hakunamatata0829
Copy link

hakunamatata0829 commented Apr 6, 2019

@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.

image

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 winenode.com@winenode.com "rm -fr ./demo ; exit"
              - sshpass -p $WINENODE_KEY scp -r ./build/ winenode.com@winenode.com:/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 winenode.com@winenode.com "rm -fr ./testdemo ; exit"
              - sshpass -p $WINENODE_KEY scp -r ./build/ winenode.com@winenode.com:/var/www/winenode.com/testdemo/

I am not sure where shall I code related cypress installing.

Please let me know solution.

Thanks

@hakunamatata0829
Copy link

hakunamatata0829 commented Apr 6, 2019

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 winenode.com@winenode.com "rm -fr ./demo ; exit"
              - sshpass -p $WINENODE_KEY scp -r ./build/ winenode.com@winenode.com:/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 winenode.com@winenode.com "rm -fr ./testdemo ; exit"
              - sshpass -p $WINENODE_KEY scp -r ./build/ winenode.com@winenode.com:/var/www/winenode.com/testdemo/

@a-x-
Copy link

a-x- commented May 19, 2019

unsetting NODE_OPTIONS has no effect

setting DISPLAY=:1.5 has no effect, too

@a-x-
Copy link

a-x- commented May 19, 2019

Currently the whole cypress is useless w/o ability to runing in CI

@tijnster
Copy link

Running into the same issue as of today, anyone has any workarounds?

@bahmutov
Copy link
Contributor

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.

@jennifer-shehane
Copy link
Member

We will be closing this issue in favor of #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. 🙏

@jennifer-shehane jennifer-shehane removed the stage: needs investigating Someone from Cypress needs to look at this label Jul 24, 2019
@rscircus

This comment has been minimized.

@cypress-io cypress-io locked and limited conversation to collaborators Jan 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests