Docker - Browser: 'chrome' was not found on your system or is not supported by Cypress

See original GitHub issue

cypress version 4.11

Current behavior:

cypress run --browser chrome --headless --spec "**/pr/*.spec.ts"",

Tests intermittently fails with the following.

Browser: 'chrome' was not found on your system or is not supported by Cypress - on docker

This happens more frequently in azure CI services on using cypress/browsers:node12.16.2-chrome81-ff75. Workaround is to re-try the job several times.

cypress.log

Desired behavior:

Tests should run on chrome.

Test code to reproduce

Not sure how to provide a test code. This problem is very common with the above docker image and in Azure CI. I can provide the link to the CI job if needed.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:16
  • Comments:32 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
pgfisicocommented, Apr 27, 2021

I believe this is an issue with the Cypress launcher and not Docker image related. The issue is caused by not fully reading the output of the browser’s version command. In the cypress:launcher logs you will see Could not extract version from stdout using regex: { stdout: '', versionRegex: <varies depending on browser> }. Note that stdout is empty and this log message is different from what you see when the binary is not found (which results in ENOENT for example).

The issue is in getOutput() https://github.com/cypress-io/cypress/blob/60b217cccedf28c56b0573665f0b3ee81813a4cc/packages/launcher/lib/utils.ts#L8-L40

When the exit event occurs it is not guaranteed that the stdio streams are closed.

According to the PR that introduced getOutput() (https://github.com/cypress-io/cypress/pull/7039)

mysteriously, execa would hang on --version when used with the snap

To resolve the issue, Cypress could revert to using the execa package (assuming no breakage as mentioned in the PR) or update getOutput() to ensure it fully reads the output.


As an example, for Chrome Cypress tries all of google-chrome, chrome, and google-chrome-stable by default.

https://github.com/cypress-io/cypress/blob/60b217cccedf28c56b0573665f0b3ee81813a4cc/packages/launcher/lib/browsers.ts#L7-L14

In the Cypress Docker images, only google-chrome and google-chrome-stable can be used to run Chrome; chrome does not work. This gives Cypress two tries to detect the browser. If running one binary fails to detect the browser because Cypress did not fully read the output, the opposite binary could still work. If the output is not read completely for both binaries then Cypress will conclude that Chrome is not installed. The issue is intermittent due to the timing related nature of the issue (sometimes stdout will have been fully read when the exit event occurs but sometimes it hasn’t) and that Cypress may have to encounter the issue multiple times before detection of a single browser fails.

I have observed one of the two Chrome detections fail in the Docker container by running cypress info in an infinite loop.


I have observed the general issue when running Cypress intermittently with Cypress 6.x and Cypress 7.1.0.

You can see the issue with empty stdout in the provided logs

The earliest Cypress version I found this issue reported with is 4.12.0 (https://github.com/cypress-io/cypress/issues/9044). getOutput() was released in Cypress 4.4.1 (https://github.com/cypress-io/cypress/issues/7020#issuecomment-616743402)


Potential duplicate issues

Potential obsolete issues

3reactions
derek-charlescommented, Nov 30, 2021

Could a more up-to-date image containing the most up to date version of chrome-stable be released so that the workaround can be utilized? The application that I have automation built requires t the most recent version of chrome be used or else there is an error (This is for an internal application). I am getting the " Browser: ‘chrome’ was not found on your system or is not supported by Cypress." error using cypress/base:16.5.0 docker image. My Dockerfile handles retrieving the latest version of chrome-stable.

The most recent chrome/ff image is for chrome version 94 (chrome94-ff93). I require chrome-stable 96…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cypress Docker: Chrome was not found on your sysyem
Browser : chrome was not found on your system or is not supported by Cypress. Cypress supports the following browsers:
Read more >
3 Ways to Fix Browser: Chrome Was Not Found on Your System
Usually, the error, browser: 'Chrome' was not found on your system occurs because the chrome.exe file is not installed in the default folder....
Read more >
Launching Browsers | Cypress Documentation
All Chrome* flavored browsers will be detected and are supported above Chrome 64. You can launch Chrome like this: cypress run --browser chrome....
Read more >
cypress-io/cypress - Gitter
I'm trying to run Cypress within docker (interactive mode), as described here [1], but shortly into a ... Browser: 'chrome' was not found...
Read more >
How to Run Cypress Tests in Chrome and Edge | BrowserStack
Cypress browser support includes giants such as Google Chrome, ... For example, by only running smoke tests against Chrome and not Firefox, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found