Error: EACCES: Permission Denied (Cypress 13.13.2) - Macos darwin-arm64 (24.0.0)
Current behavior
OS: MacOS darwin-arm64 (Apple M1 Silicon) Cypress version: 13.13.2 Pnpm version: 9.12.1 Node version: 20.3.0 Nix: 2.24.9 Devenv: 1.3.1 (aarch64-darwin)
While running pnpm cypress open or pnpm cypress run I get the following Error: EACCES: permission denied
Stack Trace
pnpm cypress open
Note: You have set the environment variable:
CYPRESS_RUN_BINARY=/nix/store/dr4c234sscmrdmqgvazwqh1dzrldl13k-cypress-13.13.2/bin/Cypress
This overrides the default Cypress binary path used.
It looks like this is your first time using Cypress: 13.13.2
An unexpected error occurred while verifying the Cypress executable.
Please search Cypress documentation for possible solutions:
https://on.cypress.io
Check if there is a GitHub issue describing this crash:
https://github.com/cypress-io/cypress/issues
Consider opening a new issue.
----------
Error: EACCES: permission denied, open '/nix/store/dr4c234sscmrdmqgvazwqh1dzrldl13k-cypress-13.13.2/opt/cypress/binary_state.json'
----------
Platform: darwin-arm64 (24.0.0)
Cypress Version: 13.13.2
I have already allowed in my macos Privacy & Security tab for Cypress to open per the workaround proposed in issue #24822 however the error still persists. For more context, I am using nix devenv. I can verify that the Cypress binary is there and the script pnpm cypress open does run against the Nix Cypress package binary. Has the community found a workaround or is this a net new bug found only with Nix dev ecosystem?
// devenv.nix
{ pkgs, inputs, ... }:
let
node_pkgs = import inputs.node {system = pkgs.stdenv.system; };
in
{
# https://devenv.sh/basics/
env.CYPRESS_INSTALL_BINARY=0;
env.CYPRESS_RUN_BINARY="${pkgs.cypress}/bin/Cypress";
# https://devenv.sh/packages/
packages = [
node_pkgs.nodejs_20
pkgs.cypress # We use Nix version for full cross environment compatibility.
pkgs.pnpm
];
Desired behavior
No response
Test code to reproduce
n/a
Cypress Version
13.13.2
Node version
20.3.0
Operating System
macOS 15.0.1
Debug Logs
DEBUG=cypress:* pnpm cypress run
cypress:cli:cli cli starts with arguments ["/nix/store/50igyc86g95b9yjc5hxn6g8qdq6344bi-nodejs-20.3.0/bin/node","/Users/k/Desktop/k/node_modules/cypress/bin/cypress","run"] +0ms
cypress:cli NODE_OPTIONS is not set +0ms
cypress:cli:cli program parsing arguments +2ms
cypress:cli:cli running Cypress with args [ Command { _events: [Object: null prototype] { 'option:auto-cancel-after-failures': [Function (anonymous)], 'option:browser': [Function (anonymous)], 'option:ci-build-id': [Function (anonymous)], 'option:component': [Function (anonymous)], 'option:config': [Function (anonymous)], 'option:config-file': [Function (anonymous)], 'option:e2e': [Function (anonymous)], 'option:env': [Function (anonymous)], 'option:group': [Function (anonymous)], 'option:key': [Function (anonymous)], 'option:headed': [Function (anonymous)], 'option:headless': [Function (anonymous)], 'option:no-exit': [Function (anonymous)], 'option:parallel': [Function (anonymous)], 'option:port': [Function (anonymous)], 'option:project': [Function (anonymous)], 'option:quiet': [Function (anonymous)], 'option:record': [Function (anonymous)], 'option:reporter': [Function (anonymous)], 'option:runner-ui': [Function (anonymous)], 'option:no-runner-ui': [Function (anonymous)], 'option:reporter-options': [Function (anonymous)], 'option:spec': [Function (anonymous)], 'option:tag': [Function (anonymous)], 'option:dev': [Function (anonymous)] }, _eventsCount: 25, _maxListeners: undefined, commands: [], options: [ [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option] ], parent: Command { _events: [Object: null prototype], _eventsCount: 1, _maxListeners: undefined, commands: [Array], options: [Array], parent: null, _allowUnknownOption: false, _args: [], rawArgs: [Array], _scriptPath: '/Users/testUser/Desktop/xyz/abc-frontend/node_modules/cypress/bin/cypress', _name: 'cypress', _optionValues: {}, _storeOptionsAsProperties: true, _storeOptionsAsPropertiesCalled: true, _passCommandToAction: true, _actionResults: [], _actionHandler: null, _executableHandler: false, _executableFile: null, _defaultCommandName: null, _exitCallback: null, _aliases: [], _combineFlagAndOptionalValue: true, _hidden: false, _hasHelpOption: true, _helpFlags: '-h, --help', _helpDescription: 'display help for command', _helpShortFlag: '-h', _helpLongFlag: '--help', _hasImplicitHelpCommand: undefined, _helpCommandName: 'help', _helpCommandnameAndArgs: 'help [command]', _helpCommandDescription: 'display help for command', _usage: '<command> [options]', args: [Array], [Symbol(kCapture)]: false }, _allowUnknownOption: false, _args: [], rawArgs: null, _scriptPath: null, _name: 'run', _optionValues: {}, _storeOptionsAsProperties: true, _storeOptionsAsPropertiesCalled: false, _passCommandToAction: true, _actionResults: [], _actionHandler: [Function: listener], _executableHandler: false, _executableFile: null, _defaultCommandName: null, _exitCallback: null, _aliases: [], _combineFlagAndOptionalValue: true, _hidden: false, _hasHelpOption: true, _helpFlags: '-h, --help', _helpDescription: 'display help for command', _helpShortFlag: '-h', _helpLongFlag: '--help', _hasImplicitHelpCommand: 0, _helpCommandName: 'help', _helpCommandnameAndArgs: 'help [command]', _helpCommandDescription: 'display help for command', _usage: '[options]', _description: 'Runs Cypress tests from the CLI without the GUI', _argsDescription: undefined, exit: true, args: [], [Symbol(kCapture)]: false } ] +0ms
cypress:cli:cli variable-length opts parsed { args: [ '/nix/store/50igyc86g95b9yjc5hxn6g8qdq6344bi-nodejs-20.3.0/bin/node', '/Users/testUser/Desktop/xyz/abc-frontend/node_modules/cypress/bin/cypress', 'run' ], opts: Command { _events: [Object: null prototype] { 'option:auto-cancel-after-failures': [Function (anonymous)], 'option:browser': [Function (anonymous)], 'option:ci-build-id': [Function (anonymous)], 'option:component': [Function (anonymous)], 'option:config': [Function (anonymous)], 'option:config-file': [Function (anonymous)], 'option:e2e': [Function (anonymous)], 'option:env': [Function (anonymous)], 'option:group': [Function (anonymous)], 'option:key': [Function (anonymous)], 'option:headed': [Function (anonymous)], 'option:headless': [Function (anonymous)], 'option:no-exit': [Function (anonymous)], 'option:parallel': [Function (anonymous)], 'option:port': [Function (anonymous)], 'option:project': [Function (anonymous)], 'option:quiet': [Function (anonymous)], 'option:record': [Function (anonymous)], 'option:reporter': [Function (anonymous)], 'option:runner-ui': [Function (anonymous)], 'option:no-runner-ui': [Function (anonymous)], 'option:reporter-options': [Function (anonymous)], 'option:spec': [Function (anonymous)], 'option:tag': [Function (anonymous)], 'option:dev': [Function (anonymous)] }, _eventsCount: 25, _maxListeners: undefined, commands: [], options: [ [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option] ], parent: Command { _events: [Object: null prototype], _eventsCount: 1, _maxListeners: undefined, commands: [Array], options: [Array], parent: null, _allowUnknownOption: false, _args: [], rawArgs: [Array], _scriptPath: '/Users/testUser/Desktop/xyz/abc-frontend/node_modules/cypress/bin/cypress', _name: 'cypress', _optionValues: {}, _storeOptionsAsProperties: true, _storeOptionsAsPropertiesCalled: true, _passCommandToAction: true, _actionResults: [], _actionHandler: null, _executableHandler: false, _executableFile: null, _defaultCommandName: null, _exitCallback: null, _aliases: [], _combineFlagAndOptionalValue: true, _hidden: false, _hasHelpOption: true, _helpFlags: '-h, --help', _helpDescription: 'display help for command', _helpShortFlag: '-h', _helpLongFlag: '--help', _hasImplicitHelpCommand: undefined, _helpCommandName: 'help', _helpCommandnameAndArgs: 'help [command]', _helpCommandDescription: 'display help for command', _usage: '<command> [options]', args: [Array], [Symbol(kCapture)]: false }, _allowUnknownOption: false, _args: [], rawArgs: null, _scriptPath: null, _name: 'run', _optionValues: {}, _storeOptionsAsProperties: true, _storeOptionsAsPropertiesCalled: false, _passCommandToAction: true, _actionResults: [], _actionHandler: [Function: listener], _executableHandler: false, _executableFile: null, _defaultCommandName: null, _exitCallback: null, _aliases: [], _combineFlagAndOptionalValue: true, _hidden: false, _hasHelpOption: true, _helpFlags: '-h, --help', _helpDescription: 'display help for command', _helpShortFlag: '-h', _helpLongFlag: '--help', _hasImplicitHelpCommand: 0, _helpCommandName: 'help', _helpCommandnameAndArgs: 'help [command]', _helpCommandDescription: 'display help for command', _usage: '[options]', _description: 'Runs Cypress tests from the CLI without the GUI', _argsDescription: undefined, exit: true, args: [], [Symbol(kCapture)]: false } } +121ms
cypress:cli parsed cli options {} +123ms
cypress:cli verifying Cypress app +0ms
cypress:cli checking environment variables +0ms
cypress:cli Using CYPRESS_RUN_BINARY from environment variable +0ms
cypress:cli Using CYPRESS_RUN_BINARY from environment variable +0ms
cypress:cli CYPRESS_RUN_BINARY exists, = /nix/store/dr4c234sscmrdmqgvazwqh1dzrldl13k-cypress-13.13.2/bin/Cypress +0ms
Note: You have set the environment variable:
CYPRESS_RUN_BINARY=/nix/store/dr4c234sscmrdmqgvazwqh1dzrldl13k-cypress-13.13.2/bin/Cypress
This overrides the default Cypress binary path used.
cypress:cli CYPRESS_RUN_BINARY is executable? : true +3ms
cypress:cli CYPRESS_RUN_BINARY has realpath: /nix/store/dr4c234sscmrdmqgvazwqh1dzrldl13k-cypress-13.13.2/opt/cypress/Cypress.app/Contents/MacOS/Cypress +0ms
cypress:cli CYPRESS_RUN_BINARY has binaryDir: /nix/store/dr4c234sscmrdmqgvazwqh1dzrldl13k-cypress-13.13.2/opt/cypress/Cypress.app +2ms
cypress:cli checking if executable exists /nix/store/dr4c234sscmrdmqgvazwqh1dzrldl13k-cypress-13.13.2/opt/cypress/Cypress.app/Contents/MacOS/Cypress +0ms
cypress:cli Binary is executable? : true +2ms
cypress:cli binaryDir is /nix/store/dr4c234sscmrdmqgvazwqh1dzrldl13k-cypress-13.13.2/opt/cypress/Cypress.app +0ms
cypress:cli Reading binary package.json from: /nix/store/dr4c234sscmrdmqgvazwqh1dzrldl13k-cypress-13.13.2/opt/cypress/Cypress.app/Contents/Resources/app/package.json +2ms
cypress:cli Found binary version 13.13.2 installed in: /nix/store/dr4c234sscmrdmqgvazwqh1dzrldl13k-cypress-13.13.2/opt/cypress/Cypress.app +1ms
cypress:cli could not read binary_state.json file at "/nix/store/dr4c234sscmrdmqgvazwqh1dzrldl13k-cypress-13.13.2/opt/cypress/binary_state.json" +2ms
cypress:cli {} +0ms
cypress:cli is Verified ? undefined +1ms
cypress:cli running binary verification check 13.13.2 +0ms
It looks like this is your first time using Cypress: 13.13.2
cypress:cli clearing out the verified version +4ms
cypress:cli needs Xvfb? false +0ms
cypress:cli spawning, should retry on display problem? false +0ms
cypress:cli disabling Electron sandbox +0ms
cypress:cli running smoke test +0ms
cypress:cli using Cypress executable /nix/store/dr4c234sscmrdmqgvazwqh1dzrldl13k-cypress-13.13.2/opt/cypress/Cypress.app/Contents/MacOS/Cypress +0ms
cypress:cli smoke test command: /nix/store/dr4c234sscmrdmqgvazwqh1dzrldl13k-cypress-13.13.2/opt/cypress/Cypress.app/Contents/MacOS/Cypress --no-sandbox --smoke-test --ping=23 +0ms
cypress:cli smoke test timeout 30000 ms +0ms
cypress:cli smoke test stdout "It looks like you are running the Cypress binary directly.
This is not the recommended approach, and Cypress may not work correctly.
Please install the cypress NPM package and follow the instructions here:
https://on.cypress.io/installing-cypress
23" +996ms
cypress:cli write verified: true +510ms
cypress:cli could not read binary_state.json file at "/nix/store/dr4c234sscmrdmqgvazwqh1dzrldl13k-cypress-13.13.2/opt/cypress/binary_s
cypress:cli detecting arch { osPlatform: 'darwin', osArch: 'arm64' } +2s
An unexpected error occurred while verifying the Cypress executable.
Please search Cypress documentation for possible solutions:
https://on.cypress.io
Check if there is a GitHub issue describing this crash:
https://github.com/cypress-io/cypress/issues
Consider opening a new issue.
----------
Error: EACCES: permission denied, open '/nix/store/dr4c234sscmrdmqgvazwqh1dzrldl13k-cypress-13.13.2/opt/cypress/binary_state.json'
----------
Platform: darwin-arm64 (24.0.0)
Cypress Version: 13.13.2
Other
No response
https://github.com/cypress-io/cypress/issues/28663 seems related... Should note that this exact same setup is working on Linux systems just fine. Seems to be an issue specifically with Mac.
Hi @nam-smyl-fitness, thanks for reporting the issue. I'm not sure we have run into this exactly. Is it possible that nix is locking down that store directory? If so, I wonder if setting CYPRESS_CACHE_FOLDER to somewhere outside of the nix store would resolve the issue.
- There was a related report in https://github.com/cypress-io/cypress/issues/30601 and according to https://github.com/NixOS/nixpkgs/pull/332513 there are known downstream issues with the NixOS builds for Cypress.
Basically the current version on 13.2.0 is broken as well as it actually builds with a 12.x binary which is even more outdated.
- This issue has also been cross-posted to https://github.com/NixOS/nixpkgs/issues/357366
- There was a related report in https://github.com/cypress-io/cypress/issues/30601 and according to https://github.com/NixOS/nixpkgs/pull/332513 there are known downstream issues with the NixOS builds for Cypress.
Basically the current version on 13.2.0 is broken as well as it actually builds with a 12.x binary which is even more outdated.
It seems that your comments are related specifically to v13.2.0.
I can confirm that v13.13.2 works fine with Nix on both NixOS and Ubuntu.
@kourtni
I can confirm that v13.13.2 works fine with Nix on both NixOS and Ubuntu.
It's good that you can narrow down the issue.
If I have understood the logs and other comments correctly, it looks like there is an issue running the nix unstable package [email protected] under NixOS 24.0.0 run virtually in macOS 15.0.1 on arm64 architecture.
Platform: darwin-arm64 (24.0.0) Cypress Version: 13.13.2
Considering that there haven't been similar reports of running that version of Cypress natively under macOS, it could be a nix packaging issue. The nix Cypress package maintainers have been pinged in https://github.com/NixOS/nixpkgs/issues/357366 and that is probably the best place to be following up at this time.
https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/development/web/cypress/default.nix
Hi @nam-smyl-fitness, thanks for reporting the issue. I'm not sure we have run into this exactly. Is it possible that nix is locking down that store directory? If so, I wonder if setting
CYPRESS_CACHE_FOLDERto somewhere outside of the nix store would resolve the issue.
env.CYPRESS_INSTALL_BINARY=0;
env.CYPRESS_RUN_BINARY="${pkgs.cypress}/bin/Cypress";
# https://devenv.sh/packages/
packages = [
node_pkgs.nodejs_20
pkgs.cypress # We use Nix version for full cross environment compatibility.
pkgs.git
pkgs.pnpm
];
Within this devenv.nix block, Cypress is being installed from the main Nix package repository and adds Cypress bins to the nix store directory. Pnpm, git etc. (also within the nix store directory) works as expected running their respective commands which means it may not be a location issue.
Also, where are you finding this CYPRESS_CACHE_FOLDER? Do you mean the Cypress binaries? If I moved it out, where would env.CYPRESS_RUN_BINARY pick up the cypress binaries?
@nam-smyl-fitness
Also, where are you finding this CYPRESS_CACHE_FOLDER? Do you mean the Cypress binaries?
CYPRESS_CACHE_FOLDER is the destination for the unpacked Cypress binaries. See https://docs.cypress.io/app/references/advanced-installation for information and definitions.
You should be able to find out the current setting for CYPRESS_CACHE_FOLDER if you execute
pnpm cypress cache path
See https://docs.cypress.io/app/references/command-line#cypress-cache-path
@nam-smyl-fitness
Edit: Will not work on Cypress 13.13.2!
You may be able to work around this issue by setting the environment variable
CYPRESS_SKIP_VERIFY=true
See https://docs.cypress.io/app/references/advanced-installation#Environment-variables
The issue is that Cypress tries to write
/nix/store/dr4c234sscmrdmqgvazwqh1dzrldl13k-cypress-13.13.2/opt/cypress/binary_state.json
and Cypress is denied access, presumably because the directory is read-only.
If you set the above environment variable, then no verify is attempted and there is no attempt to write binary_state.json. I don't have your environment, however I did successfully test it on Ubuntu 24.04.1 LTS with Cypress 13.16.0.
~~There is no documented restriction that binary directories have to be writeable, so at least the restrictions should be added to the documentation. If this is not intentional behavior, it may also be classified as a bug.~~ If it is supposed to work this way, then it could also be an enhancement request to make Cypress more tolerant of running in a partial read-only environment. Perhaps @ryanthemanuel could comment?
- I submitted a separate issue to cover the underlying problem of Cypress failing to verify if the directory containing the Cypress binary is read-only https://github.com/cypress-io/cypress/issues/30684
@nam-smyl-fitness
Please let us know if setting the environment variable CYPRESS_SKIP_VERIFY to the value true enables you to run Cypress.
The documentation on Run binary has also been updated to include this information.
Unfortunately I just realized that since CYPRESS_SKIP_VERIFY was introduced in Cypress 13.14.0 in August 2024, that the workaround will not work for Cypress 13.13.2, released in July 2024.
The options would be:
- NixOS/nixpkg packages a version of Cypress
13.14.0or above. - The directory where
CYPRESS_RUN_BINARYis made writable - The Cypress Binary is moved to a location which is writable
- Cypress is used in the regular way on a Linux system without NixOS/nixpkg technology
Sorry for the previous misleading advice!
@dmundra
I am getting this on Arm with 11.2.0 version as well.
CYPRESS_SKIP_VERIFYdidn't work for me. I am using the docker image though.
Are you using Cypress also in a NixOS/nixpkg configuration? If not, then please open a separate issue. You write that you are using Cypress 11.2.0, which is a much older version from Nov 2022.
Thank you @MikeMcC399. That makes sense. Instead of deleting I should have updated my comment stating that the issue was indeed separate and also docker related. Apologies.
Unfortunately I just realized that since
CYPRESS_SKIP_VERIFYwas introduced in Cypress 13.14.0 in August 2024, that the workaround will not work for Cypress13.13.2, released in July 2024.The options would be:
- NixOS/nixpkg packages a version of Cypress
13.14.0or above.- The directory where
CYPRESS_RUN_BINARYis made writable- The Cypress Binary is moved to a location which is writable
- Cypress is used in the regular way on a Linux system without NixOS/nixpkg technology
Sorry for the previous misleading advice!
Thanks for the additional information. Since you indicated that the workaround would only be feasible for versions of Cypress more recent than what is currently available in nixpkgs, I've submitted a PR (https://github.com/NixOS/nixpkgs/pull/361372) to update to the latest version of Cypress (13.16.0).
- https://github.com/NixOS/nixpkgs/pull/361372 is closed and superseded by https://github.com/NixOS/nixpkgs/pull/363865
@kourtni
- Were you able to re-test with Cypress
13.17.0? I'm seeing that https://github.com/NixOS/nixpkgs/pull/363865 is now merged.
- Were you able to re-test with Cypress
13.17.0? I'm seeing that cypress: 13.13.2 -> 13.17.0 NixOS/nixpkgs#363865 is now merged.
@MikeMcC399 it was taking too long to get resolved, so the team moved to Playwright.
@kourtni
Thanks for getting back! Sorry to hear that the NixOS ecosystem wasn't able to react fast enough! Judging by the conversations we get in Discord, most Linux users are on Ubuntu or Debian, and NixOS is hardly mentioned.
Good luck with your projects!
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.