cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.73k stars 3.16k forks source link

[Docker] No version of Cypress is installed #4464

Closed ghost closed 1 year ago

ghost commented 5 years ago

Current behavior:

Sometimes, when I launch yarn cypress:open from my docker container, it fails: (before that a yarn install as been execute)

root@ecc2886f9e9e:/usr/src/client# yarn cypress:open
yarn run v1.16.0
$ cypress open
No version of Cypress is installed in: /root/.cache/Cypress/3.3.1/Cypress

Please reinstall Cypress by running: cypress install

----------

Cypress executable not found at: /root/.cache/Cypress/3.3.1/Cypress/Cypress

----------

Platform: linux (Debian - 9.9)
Cypress Version: 3.3.1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Desired behavior:

It should work everytime.

Steps to reproduce: (app code and test code)

Versions

cypress 3.3.1

running on Ubuntu 18.04.2 LTS Docker version 18.09.6, build 481bc77 docker-compose version 1.24.0, build 0aa59064

Step 6/7 : RUN echo  " node version:    $(node -v) \n"           "npm version:     $(npm -v) \n"           "yarn version:    $(yarn -v) \n"           "debian version:  $(cat /etc/debian_version) \n"           "Chrome version:  $(google-chrome --version) \n"
 ---> Running in 39ab6e031d37
 node version:    v10.16.0 
 npm version:     6.9.0 
 yarn version:    1.16.0 
 debian version:  9.9 
 Chrome version:  Google Chrome 75.0.3770.90 

This is my docker configuration

Dockerfile:

FROM node:10.16.0

RUN apt-get update && \
  apt-get install -y \
  libgtk2.0-0 \
  libnotify-dev \
  libgconf-2-4 \
  libnss3 \
  libxss1 \
  libasound2 \
  xvfb \
  zip

RUN echo "install last google-chrome-stable"
RUN \
  wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
  echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list && \
  apt-get update && \
  apt-get install -y dbus-x11 google-chrome-stable && \
  rm -rf /var/lib/apt/lists/*

RUN echo  " node version:    $(node -v) \n" \
          "npm version:     $(npm -v) \n" \
          "yarn version:    $(yarn -v) \n" \
          "debian version:  $(cat /etc/debian_version) \n" \
          "Chrome version:  $(google-chrome --version) \n"

RUN mkdir -p /usr/src/client

docker-compose.yml:

version: "3.7"

services:
  front:
    build: ./docker
    container_name: frontend
    tty: true
    working_dir: /usr/src/client
    environment:
      - DISPLAY
    ports:
      - 8082:8082
    volumes:
      - .:/usr/src/client:rw
      - ~/.cache/yarn:/usr/local/share/.cache/yarn:rw
      - /tmp/.X11-unix:/tmp/.X11-unix

networks:
  default:
    external:
      name: amms
ghost commented 5 years ago

If I sudo rm -rf nodes_modules from my app and reinstall dependencies, when I run yarn cypress:run there no problem, the Cypress Test Runner is launch.

bahmutov commented 5 years ago

Show the output from yarn install command in that container

Sent from my iPhone

On Jun 14, 2019, at 09:15, Frédéric Jost notifications@github.com wrote:

If I sudo rm -rf nodes_modules from my app and reinstall dependencies, when I run yarn cypress:run there no problem, the Cypress Test Runner is launch.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

ghost commented 5 years ago

After remove nodes_module and yarn.lock, then rebuild docker image, this is the output with some warning, nothing related to cypress

# yarn
yarn install v1.16.0
info No lockfile found.
[1/5] Validating package.json...
[2/5] Resolving packages...
warning @angular/http@5.2.11: Switch to @angular/common/http - see https://angular.io/guide/http
warning @types/angular-ui-router@1.1.40: '@types/angular-ui-router' is now '@uirouter/angularjs', which provides its own types.
warning angular-ui-router@0.4.2: This npm package 'angular-ui-router' has been renamed to '@uirouter/angularjs'. Please update your package.json. See https://ui-router.github.io/blog/uirouter-scoped-packages/
warning angular-ui-select@0.12.100: This is an unmaintained version. Please use the module 'ui-select'
warning autoprefixer > browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning coffeeify > coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
warning imagemin-gifsicle > gifsicle > bin-wrapper > globby > glob > minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning imagemin-gifsicle > gifsicle > bin-wrapper > download > vinyl-fs > glob-stream > minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning imagemin-gifsicle > gifsicle > bin-wrapper > download > vinyl-fs > graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
warning imagemin-gifsicle > gifsicle > bin-build > download > gulp-decompress > gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
warning imagemin-gifsicle > gifsicle > bin-wrapper > download > vinyl-fs > graceful-fs > natives@1.1.6: This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs@4.x.
warning imagemin-gifsicle > gifsicle > bin-wrapper > download > vinyl-fs > glob-watcher > gaze > globule > minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning imagemin-gifsicle > gifsicle > bin-wrapper > download > vinyl-fs > glob-watcher > gaze > globule > glob > minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning imagemin-gifsicle > gifsicle > bin-wrapper > download > vinyl-fs > glob-watcher > gaze > globule > glob > graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
warning extract-text-webpack-plugin@3.0.2: Deprecated. Please use https://github.com/webpack-contrib/mini-css-extract-plugin
warning jest > jest-cli > prompts > kleur@2.0.2: Please upgrade to kleur@3 or migrate to 'ansi-colors' if you prefer the old syntax. Visit <https://github.com/lukeed/kleur/releases/tag/v3.0.0\> for migration path(s).
warning jest > jest-cli > jest-environment-jsdom > jsdom > left-pad@1.3.0: use String.prototype.padStart()
[3/5] Fetching packages...
info fsevents@1.2.9: The platform "linux" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning " > @angular/forms@4.4.7" has incorrect peer dependency "@angular/core@4.4.7".
warning " > @angular/forms@4.4.7" has incorrect peer dependency "@angular/common@4.4.7".
warning " > @angular/forms@4.4.7" has incorrect peer dependency "@angular/platform-browser@4.4.7".
warning " > @progress/kendo-angular-dropdowns@1.6.1" has incorrect peer dependency "rxjs@^5 <5.5".
warning "@progress/kendo-angular-dropdowns > @progress/kendo-angular-popup@1.3.4" has incorrect peer dependency "rxjs@^5 <5.5".
warning "@progress/kendo-angular-dropdowns > @progress/kendo-angular-resize-sensor@2.0.2" has incorrect peer dependency "rxjs@^5 <5.5".
warning " > @progress/kendo-angular-inputs@1.5.0" has incorrect peer dependency "rxjs@^5 <5.5".
warning " > @progress/kendo-theme-bootstrap@2.18.0" has unmet peer dependency "bootstrap@^4.0.0".
warning "angular-bootstrap-switch > bootstrap@4.3.1" has unmet peer dependency "popper.js@^1.14.7".
warning " > ng2-dnd@4.2.0" has incorrect peer dependency "@angular/core@^2.4.4 || ^4.0.0".
warning " > ngx-tooltip@0.0.9" has incorrect peer dependency "@angular/core@^2.0.0".
warning " > css-loader@1.0.1" has incorrect peer dependency "webpack@^4.0.0".
warning " > jest-preset-angular@5.0.0" has incorrect peer dependency "jest@^22.0.0".
[5/5] Building fresh packages...
success Saved lockfile.

Cypress is installed in node_modules

{
  "name": "cypress",
  "version": "3.3.1",
  "main": "index.js",
  "bin": {
    "cypress": "bin/cypress"
  },

with its binary

cypress open is executed but sometimes I have to remove then reinstall node_modules, I don't know exactly when it happens, I just start to use it, the next time when it's occur, I will post what I do before

ghost commented 5 years ago

I encontered the same issue when down the container then up

Surm4 commented 4 years ago

Got the same problem Screenshot from 2020-09-21 16-55-27

Cypress version: "^5.1.0" My dockerfile:

FROM ubuntu:18.04
USER root

RUN apt-get update
RUN apt-get -y install curl gnupg
RUN curl -sL https://deb.nodesource.com/setup_12.x  | bash -
RUN apt-get -y install nodejs
RUN apt-get install -y git-core
RUN apt-get install -y openssh-client
RUN apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
RUN apt-get install -y lsof

...
RUN npm install
RUN npm run e2e
Surm4 commented 3 years ago

If someone still has a problem with this, it's due to linux permissions. I had to change user to a non-root user then change permissions for {user}./cache directory and then I ran npm i as the same non-root user

bahmutov commented 3 years ago

Yes, @SurmaAa is correct - the same user should install and run Cypress inside the Docker container.

har-preet commented 3 years ago

services: dev: image: cypress/browsers:latest volumes:

omkar-nath commented 2 years ago

I am also facing the issue. I am trying to run Cypress inside ubuntu: 20 docker image.

mikejdegroot commented 2 years ago

did anyone find a solution to this? I seem to be experiencing the same issue

dockerfile: RUN CYPRESS_CACHE_FOLDER=/root/.cache/Cypress yarn cypress install

output: No version of Cypress is installed in: /root/.cache/Cypress/9.5.1/Cypress

cypress-app-bot commented 1 year ago

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

cypress-app-bot commented 1 year ago

This issue has been closed due to inactivity.