cypress: Docker - Browser: 'chrome' was not found on your system or is not supported by Cypress
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.
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.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 18
- Comments: 32 (3 by maintainers)
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:launcherlogs you will seeCould not extract version from stdout using regex: { stdout: '', versionRegex: <varies depending on browser> }. Note thatstdoutis empty and this log message is different from what you see when the binary is not found (which results inENOENTfor example).The issue is in
getOutput()https://github.com/cypress-io/cypress/blob/60b217cccedf28c56b0573665f0b3ee81813a4cc/packages/launcher/lib/utils.ts#L8-L40When the
exitevent 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)To resolve the issue, Cypress could revert to using the
execapackage (assuming no breakage as mentioned in the PR) or updategetOutput()to ensure it fully reads the output.As an example, for Chrome Cypress tries all of
google-chrome,chrome, andgoogle-chrome-stableby default.https://github.com/cypress-io/cypress/blob/60b217cccedf28c56b0573665f0b3ee81813a4cc/packages/launcher/lib/browsers.ts#L7-L14
In the Cypress Docker images, only
google-chromeandgoogle-chrome-stablecan be used to run Chrome;chromedoes 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 theexitevent 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 infoin 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 Cypress4.4.1(https://github.com/cypress-io/cypress/issues/7020#issuecomment-616743402)Potential duplicate issues
Potential obsolete issues
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…
Cypress looks for chrome installation in this Path: “C:/Program Files (x86)/Google/Chrome/Application/chrome.exe”. If chrome installed in “C:/Program Files/” then it will throw an error.
Intermittent issue on our CI with cypress@6.2.1 using Cypress official Docker image.
Same error, approx 1/50th of the time. Restarting the job almost always results in a successful run. No clear pattern.
If I may say so that is not a very good description of how one is supposed to work around the problem. I get this issue with 8.7.0 when using github-actions. Where does one specify
cypress/browsers:node12.18.3-chrome89-ff86?I had exactly same issue with version : 8.3.0 . any help please !
ughh, @pgfisico I ran Chrome detection 1000 times in a row in a Docker container, did not see the empty output. Do you know how one could see the STDOUT still streaming after the
exitevent? I would love to recreate this behavior before changing thegetOutput()function