-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cypress cannot write to the cache directory due to file permissions in Bitbucket pipeline #15025
Comments
I solved this by adding - step:
name: Install dependencies
caches:
- npm
- cypress
- node
script:
- unset NPM_CONFIG_USER
- npm ci |
I reproduced this with a local node:alpine docker image, so this has nothing to do with Bitbucket Pipelines (but I found this issue there as well). I think it is more related to the default usage of the root user in docker containers, because sudoing into the "node" user fixes the issue. |
@maxsuelmarinho that wasn't working for me, but this might be due to my usage of npm@7 I also tried exporting CYPRESS_CACHE_FOLDER=/tmp/foo-cypress-bar but then it simply fails due to lack of permissions on this other folder. But this is not a permission issue because
|
Downgrading to npm@6 also solves the problem. Therefore this issue is a combination of using npm@7 and the root user. |
For the record, this reproduces in Cypress version 7.7.0 |
Ok, the final trigger that puzzled me is the working directory being owned by a different user. I think this instruction
or
are the minimal reproduction of the issue. Also reproduces with node-16 and non-alpine images. Based on this, I'd hold to the hypothesis that permissions are improperly checked. Also opens the following workarounds:
cc/ @pieterjandesmedt but notice the bitbucket-pipeline constrained docker-in-docker engine won't let you chown repository files and everything belongs to a spooky 65534 UID/GID. That is the linux "nobody" user and sudoing into it might unleash all kinds of other problems (no writable home folder and whatnot) that will require more and more workarounds. |
Another workaround: depending on your workflow, exporting You can later try to |
Downgrading node in case cypress-io/cypress#15025 is correct.
# This is the 1st commit message: IGVF-35-cypress-circleci Try the cypress orb. # This is the commit message #2: Revert "IGVF-35-cypress-circleci" This reverts commit fa1521f. # This is the commit message #3: IGVF-35-cypress-circleci Revert last change and try a different tactic using docker-compose.test.yml. # This is the commit message #4: Revert "IGVF-35-cypress-circleci" This reverts commit 2e7ad9c. # This is the commit message #5: IGVF-35-cypress-circleci Another attempt to run Cypress in CircleCI. # This is the commit message #6: IGVF-35-cypress-circleci Alter previous attempt. # This is the commit message #7: IGVF-35-cypress-circleci Try two docker-compose files; one specifically for cypress. # This is the commit message #8: IGVF-35-cypress-circleci Possibly the wrong command to start Cypress. # This is the commit message #9: IGVF-35-cypress-circleci Try to solve EACCES error for Cypress cache. # This is the commit message #10: IGVF-35-cypress-circleci Try setting environment variable for Cypress in through the docker-compose file. # This is the commit message #11: IGVF-35-cypress-circleci Fix error setting the environment variable from the last fix. # This is the commit message #12: IGVF-35-cypress-circleci Try a different cypress cache directory # This is the commit message #13: IGVF-35-cypress-circleci Everyone seems to recommend a different syntax. Here’s yet another. # This is the commit message #14: IGVF-35-cypress-circleci Downgrading node in case cypress-io/cypress#15025 is correct. # This is the commit message #15: IGVF-35-cypress-circleci Try apt-get for cypress dependencies. # This is the commit message #16: Revert "IGVF-35-cypress-circleci" This reverts commit f7b66a5. # This is the commit message #17: IGVF-35-cypress-circleci Try using the Cypress orb. # This is the commit message #18: IGVF-35-cypress-circleci Start the server before starting the Cypress tests. # This is the commit message #19: IGVF-35-cypress-circleci Correction to last commit. Options can have very subtle effects on required syntax. # This is the commit message #20: Updated config.yml # This is the commit message #21: IGVF-35-cypress-circleci Do a build and run of production build.
# This is the 1st commit message: IGVF-35-cypress-circleci Try the cypress orb. # This is the commit message #2: Revert "IGVF-35-cypress-circleci" This reverts commit fa1521f. # This is the commit message #3: IGVF-35-cypress-circleci Revert last change and try a different tactic using docker-compose.test.yml. # This is the commit message #4: Revert "IGVF-35-cypress-circleci" This reverts commit 2e7ad9c. # This is the commit message #5: IGVF-35-cypress-circleci Another attempt to run Cypress in CircleCI. # This is the commit message #6: IGVF-35-cypress-circleci Alter previous attempt. # This is the commit message #7: IGVF-35-cypress-circleci Try two docker-compose files; one specifically for cypress. # This is the commit message #8: IGVF-35-cypress-circleci Possibly the wrong command to start Cypress. # This is the commit message #9: IGVF-35-cypress-circleci Try to solve EACCES error for Cypress cache. # This is the commit message #10: IGVF-35-cypress-circleci Try setting environment variable for Cypress in through the docker-compose file. # This is the commit message #11: IGVF-35-cypress-circleci Fix error setting the environment variable from the last fix. # This is the commit message #12: IGVF-35-cypress-circleci Try a different cypress cache directory # This is the commit message #13: IGVF-35-cypress-circleci Everyone seems to recommend a different syntax. Here’s yet another. # This is the commit message #14: IGVF-35-cypress-circleci Downgrading node in case cypress-io/cypress#15025 is correct. # This is the commit message #15: IGVF-35-cypress-circleci Try apt-get for cypress dependencies. # This is the commit message #16: Revert "IGVF-35-cypress-circleci" This reverts commit f7b66a5. # This is the commit message #17: IGVF-35-cypress-circleci Try using the Cypress orb. # This is the commit message #18: IGVF-35-cypress-circleci Start the server before starting the Cypress tests. # This is the commit message #19: IGVF-35-cypress-circleci Correction to last commit. Options can have very subtle effects on required syntax. # This is the commit message #20: Updated config.yml # This is the commit message #21: IGVF-35-cypress-circleci Do a build and run of production build. # This is the commit message #22: IGVF-35-cypress-circleci Try anything.
Try using I'm using Jenkins in an alpine linux container with node 16.
The error I was getting is the following:
In my same case export the environment variable cypress cache folder did not work as expected, the error was even made mentioned above.
|
I was getting same issue: I've fixed like this:
I messed up a time with this issue, and I tried with permissions Hope this help anyone. |
I'm not sure if this will work around the problem for others, but seems to have for me: FROM node:16-bullseye as development
EXPOSE 3000
ENV APP_HOME=/usr/src/app \
CYPRESS_CACHE_FOLDER="/cypress/.cache" \
LANG=C.UTF-8
WORKDIR $APP_HOME
RUN mkdir -p $CYPRESS_CACHE_FOLDER
COPY ./package.json ./
COPY ./package-lock.json ./
RUN npm install The key here being that I made the cache folder first before running the YMMV! |
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided. |
This issue has been closed due to inactivity. |
Current behavior
When running
npm install
in bitbucket pipelines, this happens:Desired behavior
Don't write to the root directory. This should be fixed since 4.6.0, according to #1281
Test code to reproduce
Create a Bitbucket repository, enable pipelines, do
npm i
in the Bitbucket pipeline.Versions
6.4.0
The text was updated successfully, but these errors were encountered: