Skip to content
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

Error: EACCES: Permission Denied (Cypress 13.13.2) - Macos darwin-arm64 (24.0.0) #30652

Open
nam-smyl-fitness opened this issue Nov 19, 2024 · 8 comments

Comments

@nam-smyl-fitness
Copy link

nam-smyl-fitness commented Nov 19, 2024

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

@kourtni
Copy link

kourtni commented Nov 19, 2024

#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.

@ryanthemanuel
Copy link
Collaborator

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.

@MikeMcC399
Copy link
Contributor

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.

@MikeMcC399
Copy link
Contributor

@kourtni
Copy link

kourtni commented Nov 20, 2024

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.

@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Nov 20, 2024

@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 NixOS/nixpkgs#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

@nam-smyl-fitness
Copy link
Author

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.

  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?

@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Nov 22, 2024

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants