cypress: The cypress npm package is installed, but the Cypress binary is missing.

Current behavior

When trying to perform Cypress verify within a GitLab CI, I receive the following error:

The cypress npm package is installed, but the Cypress binary is missing.
We expected the binary to be installed here: /builds/<redacted>/frontend/<redacted>-frontend/cache/Cypress/10.3.1/Cypress/Cypress
Reasons it may be missing:
- You're caching 'node_modules' but are not caching this path: /root/.cache/Cypress
- You ran 'npm install' at an earlier build step but did not persist: /root/.cache/Cypress
Properly caching the binary will fix this error and avoid downloading and unzipping Cypress.
Alternatively, you can run 'cypress install' to download the binary again.
https://on.cypress.io/not-installed-ci-error

The CI code is as follows:

variables:
  npm_config_cache: '$CI_PROJECT_DIR/.npm'

E2E test:
  image: dps-nexus.service.nhsbsa:8444/<redacted>/centos-node14-cypress:1

  stage: Test
  only:
    - /^feature.*$/
    - /^bug.*$/
    - /^phase.*$/
    - /^spike.*$/
  artifacts:
    when: always
    paths:
      - cypress/
  cache: [] #This is to remove the possibility of a cache issue
  script:
    - npm ci
    - DEBUG=cypress:* $(npm bin)/cypress install cypress --force
    - DEBUG=cypress:* $(npm bin)/cypress cache path
    - DEBUG=cypress:* $(npm bin)/cypress cache list
    - DEBUG=cypress:* $(npm bin)/cypress verify
    - npm rebuild node-sass
    - ./node_modules/.bin/gulp build
    - DEBUG=cypress:* $(npm bin)/cypress run
  variables:
    CYPRESS_CACHE_FOLDER: '$CI_PROJECT_DIR/cache/Cypress'
  allow_failure: false
  except:
    variables:
      - $CI_COMMIT_MESSAGE =~ /WIP/

Debug logs

Cypress install force:

$ DEBUG=cypress:cli $(npm bin)/cypress install cypress --force
2022-07-25T11:30:05.413Z cypress:cli NODE_OPTIONS is not set
2022-07-25T11:30:05.673Z cypress:cli parsed cli options { force: true }
2022-07-25T11:30:05.673Z cypress:cli installing with options {"force":true}
2022-07-25T11:30:05.674Z cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable
2022-07-25T11:30:05.674Z cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable
Note: Overriding Cypress cache directory to: /builds/<redacted>/frontend/<redacted>-frontend/cache/Cypress
      Previous installs of Cypress may not be found.
2022-07-25T11:30:05.675Z cypress:cli detecting arch { osPlatform: 'linux', osArch: 'x64' }
2022-07-25T11:30:05.692Z cypress:cli arm uname -m result: { stdout: 'x86_64' } 
2022-07-25T11:30:05.692Z cypress:cli version in package.json is 10.3.1, version to install is 10.3.1
2022-07-25T11:30:05.693Z cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable
2022-07-25T11:30:05.693Z cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable
2022-07-25T11:30:05.693Z cypress:cli using environment variable CYPRESS_CACHE_FOLDER /builds/<redacted>/frontend/<redacted>-frontend/cache/Cypress
2022-07-25T11:30:05.693Z cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable
2022-07-25T11:30:05.693Z cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable
2022-07-25T11:30:05.694Z cypress:cli using environment variable CYPRESS_CACHE_FOLDER /builds/<redacted>/frontend/<redacted>-frontend/cache/Cypress
2022-07-25T11:30:05.694Z cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable
2022-07-25T11:30:05.694Z cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable
2022-07-25T11:30:05.694Z cypress:cli using environment variable CYPRESS_CACHE_FOLDER /builds/<redacted>/frontend/<redacted>-frontend/cache/Cypress
2022-07-25T11:30:05.708Z cypress:cli Reading binary package.json from: /builds/<redacted>/frontend/<redacted>-frontend/cache/Cypress/10.3.1/Cypress/resources/app/package.json
2022-07-25T11:30:05.709Z cypress:cli no binary installed under cli version
2022-07-25T11:30:05.709Z cypress:cli checking local file /builds/<redacted>/10.3.1 cwd /builds/<redacted>/frontend/<redacted>-frontend
2022-07-25T11:30:05.709Z cypress:cli Cypress already installed at /builds/<redacted>/frontend/<redacted>-frontend/cache/Cypress/10.3.1
2022-07-25T11:30:05.709Z cypress:cli but the installation was forced
2022-07-25T11:30:05.709Z cypress:cli preparing to download and unzip version  10.3.1 to path /builds/<redacted>/frontend/<redacted>-frontend/cache/Cypress/10.3.1
Installing Cypress (version: 10.3.1)
[STARTED] Task without title.
2022-07-25T11:30:05.717Z cypress:cli needed Cypress version: 10.3.1
2022-07-25T11:30:05.717Z cypress:cli source url https://download.cypress.io/desktop/10.3.1?platform=linux&arch=x64
2022-07-25T11:30:05.717Z cypress:cli downloading cypress.zip to "/tmp/cypress-202.zip"
2022-07-25T11:30:05.718Z cypress:cli Downloading package {
  url: 'https://download.cypress.io/desktop/10.3.1?platform=linux&arch=x64',
  proxy: 'https://internal-outbound-nat-1350400483.eu-west-2.elb.amazonaws.com:3',
  downloadDestination: '/tmp/cypress-202.zip'
}

Cypress cache path

$ DEBUG=cypress:cli $(npm bin)/cypress cache path
2022-07-25T11:30:06.237Z cypress:cli NODE_OPTIONS is not set
2022-07-25T11:30:06.240Z cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable
2022-07-25T11:30:06.240Z cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable
2022-07-25T11:30:06.240Z cypress:cli using environment variable CYPRESS_CACHE_FOLDER /builds/<redacted>/frontend/<redacted>-frontend/cache/Cypress
/builds/<redacted>/frontend/<redacted>-frontend/cache/Cypress

Cypress cache list

$ DEBUG=cypress:cli $(npm bin)/cypress cache list
2022-07-25T11:30:06.754Z cypress:cli NODE_OPTIONS is not set
2022-07-25T11:30:06.756Z cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable
2022-07-25T11:30:06.757Z cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable
2022-07-25T11:30:06.757Z cypress:cli using environment variable CYPRESS_CACHE_FOLDER /builds/<redacted>/frontend/<redacted>-frontend/cache/Cypress
┌─────────┬───────────┐
│ version │ last used │
└─────────┴───────────┘

Cypress verify

$ DEBUG=cypress:cli $(npm bin)/cypress verify
2022-07-25T11:30:07.266Z cypress:cli NODE_OPTIONS is not set
2022-07-25T11:30:07.272Z cypress:cli parsed cli options {}
2022-07-25T11:30:07.432Z cypress:cli verifying Cypress app
2022-07-25T11:30:07.432Z cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable
2022-07-25T11:30:07.432Z cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable
2022-07-25T11:30:07.432Z cypress:cli using environment variable CYPRESS_CACHE_FOLDER /builds/<redacted>/frontend/<redacted>-frontend/cache/Cypress
2022-07-25T11:30:07.433Z cypress:cli checking environment variables
2022-07-25T11:30:07.436Z cypress:cli checking if executable exists /builds/<redacted>/frontend/<redacted>-frontend/cache/Cypress/10.3.1/Cypress/Cypress
2022-07-25T11:30:07.442Z cypress:cli detecting arch { osPlatform: 'linux', osArch: 'x64' }
2022-07-25T11:30:07.463Z cypress:cli arm uname -m result: { stdout: 'x86_64' } 
The cypress npm package is installed, but the Cypress binary is missing.
We expected the binary to be installed here: /builds/<redacted>/frontend/<redacted>-frontend/cache/Cypress/10.3.1/Cypress/Cypress
Reasons it may be missing:
- You're caching 'node_modules' but are not caching this path: /root/.cache/Cypress
- You ran 'npm install' at an earlier build step but did not persist: /root/.cache/Cypress
Properly caching the binary will fix this error and avoid downloading and unzipping Cypress.
Alternatively, you can run 'cypress install' to download the binary again.
https://on.cypress.io/not-installed-ci-error
----------
Platform: linux-x64 (CentOS - 7.9.2009)
Cypress Version: 10.3.1

Cypress Version

10.3.1

Package Manager

npm

Operating system

Linux

Other

From the output, you can see the download of the binary is as expected and completes. However, this isn’t visible to Cypress when it tries to perform cypress cache list or cypress info. I have looked at https://gitlab.com/cypress-io/cypress-example-docker-gitlab but I have not found this to fix my issue.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (9 by maintainers)

Most upvoted comments

@tbiethman - Thank you for the link to proxy-from-env, this helped me resolve the issue. I was setting the proxy through HTTP_PROXY environment variable, however, the proxy needed to be set through http_proxy (notice the lower case). I couldn’t get your script to work as that failed every time with a disconnect and it wouldn’t pick up the proxy to be http instead of https. However, I am now able to run npm ci and Cypress is downloaded and runs as expected. Thank you for your patience in troubleshooting this!