cypress-io / cypress

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

Message received: "No version of Cypress is installed" when running in IBM cloud #4012

Closed craig10 closed 4 years ago

craig10 commented 5 years ago

Current behavior:

I am running a series of tests against my website on macos. I'd like to automate these tests and run them in the cloud which is running Ubuntu Linux 14.04. When push to the cloud and run it, I get

No version of Cypress is installed in: /home/vcap/app/node_modules/cypress/cypress_cache/3.2.0/Cypress
and
Please reinstall Cypress by running: cypress install

Desired behavior:

I expect the same results in the cloud that I get on macos.

Steps to reproduce: (app code and test code)

In node.js app, run the following which calls cypress test_spec2.js

cypress.run({
  spec: './cypress/integration/test_spec2.js',
  record: false,
  browser: 'chrome'
}).then(reportTestResults);

Versions

Cypress 3.2.0, Ubuntu Linux 14.04

jennifer-shehane commented 5 years ago

How are you installing Cypress on the Linux machine?

craig10 commented 5 years ago

I'm running it in IBM Cloud - IBM Cloud runs npm install based on package.json.

bahmutov commented 5 years ago

Please check if you actually have Cypress binary installed with the following commands: first to show where Cypress NPM module is looking for the cached binary, and then all cached binaries

$ npx cypress cache path
$ npx cypress cache list

You probably do not have the right folder cache. You need to cache usually these folders if you use npm ci

~/.npm
~/.cache

in order to cache both NPM modules and Cypress binary. See https://on.cypress.io/caching for details

craig10 commented 5 years ago

I was pulled away on other work, getting back to this project and issue. Note that the issue I have is when running in bluemix.

results of npx path and list (on local machine - macbook):

npx cache path:

/Users/craig@us.ibm.com/Library/Caches/Cypress

npx cache list:

3.1.5, 3.2.0

You probably do not have the right folder cache. You need to cache usually these folders if >you use npm ci

~/.npm
~/.cache

How do I do this?

Looking for ideas for next steps. Thanks.

craig10 commented 5 years ago

Has nobody tried automating continuous testing and validation of the app using cypress in the cloud? The snippet of my code and error receive is above. Again this runs just fine on my mac but when I upload to cloud, for whatever reason the cloud does not find the cypress executable. I have tried many variations of the following environment variables with no luck. CYPRESS_CACHE_FOLDER CYPRESS_RUN_BINARY

jennifer-shehane commented 5 years ago

We haven't personally worked with IBM Cloud as a CI service before, so I would refer to their documentation on how to cache directories during your run. https://cloud.ibm.com/docs

Alternatively, you can sign up for any of our paid plans and get access to our team for support via email.

tomachinz commented 4 years ago

It maybe caused by a bad symlink!

Notice how I have a symlink that goes to ../ even at root?

Recently, to save disk on my laptop, I torched a bunch of docker images and folders, and probably some node distros I swap around with nvm. And messing with my $PATH. Anyhow I ended up seeing this issue as well, on my mac is works like this:

➜  funk.co.nz-link npx cypress cache path
/Users/tom/Library/Caches/Cypress
➜  funk.co.nz-link npx cypress cache list
Unhandled rejection Error: ENOENT: no such file or directory, scandir '/Users/tom/Library/Caches/Cypress'
➜  ~ ls /Users/tom/Library/Caches/Cypress
ls: /Users/tom/Library/Caches/Cypress: No such file or directory
➜  funk.co.nz-link which cypress
/usr/local/bin/cypress
➜  ~ ls -lah /usr/local/bin/cypress
lrwxr-xr-x  1 tom  admin    39B 13 May 02:42 **_/usr/local/bin/cypress -> ../lib/node_modules/cypress/bin/cypress_**
➜  funk.co.nz-link cd /
➜  /  ls -lah /usr/local/bin/cypress
lrwxr-xr-x  1 tom  admin    39B 13 May 02:42 **_/usr/local/bin/cypress -> ../lib/node_modules/cypress/bin/cypress_**
➜  funk.co.nz-link cypress verify
No version of Cypress is installed in: /Users/tom/Library/Caches/Cypress/4.5.0/Cypress.app

Please reinstall Cypress by running: cypress install

Darwin moderna.fritz.box 18.7.0 Darwin Kernel Version 18.7.0: Thu Jan 23 06:52:12 PST 2020; root:xnu-4903.278.25~1/RELEASE_X86_64 x86_64

Was able to fix with

npm uninstall -g cypress
rm /usr/local/bin/cypress
npm install --save-dev cypress
jennifer-shehane commented 4 years ago

Unfortunately we have to close this issue due to inactivity. Please comment if there is new information to provide concerning the original issue and we can reopen.