How to Run Cypress in CI Without Verification Failures
Cypress downloads a separate binary at install time and needs a set of Linux libraries to launch its bundled Electron browser.
The npm package and the Cypress binary are separate. In CI you must let the binary download (or restore it from cache) and provide the GTK/X11 libraries its Electron shell needs.
Why it fails in CI
- The Cypress binary cache is empty and the download is blocked/slow → "verification timed out".
- Missing Linux libs (libgtk, libgbm, libnss3, xvfb) → the browser will not start.
- You cached
node_modulesbut not~/.cache/Cypress, so the binary is gone.
Install and run it reliably
Install the OS dependencies, install the binary, verify it, then run headless. Cache the Cypress binary directory separately from node_modules.
Terminal
apt-get update && apt-get install -y \
libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev \
libnss3 libxss1 libasound2 libxtst6 xauth xvfb
npm ci
npx cypress verify
npx cypress runCache & speed
Cache ~/.cache/Cypress keyed on the Cypress version so the binary is not re-downloaded. The binary download is a known flaky step; auto-retry on transient failures and larger managed runners help.
.github/workflows/ci.yml
- uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}Common errors
Cypress verification timed out→ restore the binary cache or raiseCYPRESS_VERIFY_TIMEOUT.Cypress failed to start ... missing dependency→ install the GTK/NSS/Xvfb libs above.The Cypress App could not be downloaded→ transient network; retry the install.
Key takeaways
- Cache
~/.cache/Cypressseparately so the binary survives runs. - Install the GTK/NSS/Xvfb libraries in slim images.
- Run
cypress verifybeforecypress runto surface issues early.
Related guides
How to Cache and Install the Cypress Binary in CIInstall and cache the Cypress binary in CI: understand the separate binary download, cache ~/.cache/Cypress,…
How to Run Puppeteer in CI Without Chromium ErrorsRun Puppeteer in CI: install the bundled Chromium, add the system libraries it needs, use --no-sandbox, and f…
How to Run Playwright (Node) Tests in CIRun Playwright Node tests in CI: install browsers with system deps, cache the browser binaries, run headless,…
Self-Healing CI: Auto-Retrying Transient Registry and 5xx FailuresRegistry timeouts, 429s, and 5xx errors are transient by definition. See why they happen and how self-healing…