From 8b65e0ff99e34a019764e4b2e86eb58fe8978c07 Mon Sep 17 00:00:00 2001 From: Mike McCready <66998419+MikeMcC399@users.noreply.github.com> Date: Sat, 4 Jan 2025 14:28:36 +0100 Subject: [PATCH] docs: add binary_state.json permission denied known problem --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index e3a878c11a..3097a6da61 100644 --- a/README.md +++ b/README.md @@ -157,6 +157,38 @@ container: See [Tag Selection](#tag-selection) above for advice on selecting a non-default image tag. +## EACCES permission denied binary_state.json + +### Problem + +If a custom Docker image is built from a `cypress/base` or `cypress/browsers` Cypress Docker image, using a `Dockerfile` to install the Cypress binary (for instance with `npx cypress install`), and the custom image is then run as a container with a non-root user, Cypress will fail to run with an error message: + +> Error: EACCES: permission denied, open '/root/.cache/Cypress/``/binary_state.json' + +This is due to an open Cypress issue [#30684](https://github.com/cypress-io/cypress/issues/30684) where Cypress fails to verify the installed Cypress binary if it does not have write access to the Cypress binary directory. + +### Workaround + +To workaround this issue, either make the Cypress binary directory writable, or skip the Cypress binary verification. + +To make the complete Cypress binary directory writable, add the following to the `Dockerfile` after the step to install the Cypress binary: + +```Dockerfile +RUN chmod -R 777 /root/.cache/Cypress +``` + +To skip Cypress binary verification using the environment variable `CYPRESS_SKIP_VERIFY`, described in the Cypress documentation [Advanced Installation](https://docs.cypress.io/app/references/advanced-installation#Environment-variables), either add the following to the `Dockerfile`: + +```Dockerfile +ENV CYPRESS_SKIP_VERIFY=true +``` + +or pass the environment variable as a CLI option: + +```shell +docker run --env CYPRESS_SKIP_VERIFY=true +``` + ## Contributing See [CONTRIBUTING.md](CONTRIBUTING.md)