cypress: cypress run fails when installed using yarn 3.x on apple silicon mac

Current behavior

Running cypress 12.x installed using yarn 3.x on Apple Silicon causes “Your application tried to access @opentelemetry/resources, but it isn’t declared in your dependencies; this makes the require call ambiguous and unsound.”


DevTools listening on ws://127.0.0.1:49377/devtools/browser/9349252f-b218-422b-96a8-333b9339c723
/private/tmp/cypress-example-kitchensink_yarn3x/.pnp.cjs:22522
      Error.captureStackTrace(firstError);
            ^

Error: Your application tried to access @opentelemetry/resources, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound.

Required package: @opentelemetry/resources
Required by: /Users/tonychia/Library/Caches/Cypress/12.17.3/Cypress.app/Contents/Resources/app/packages/telemetry/dist/

Require stack:

Desired behavior

“yarn run cypress run” should not have any issue on “Your application tried to access @opentelemetry/resources, but it isn’t declared in your dependencies; this makes the require call ambiguous and unsound” when installed using yarn 3.x on Apple Silicon Mac

Test code to reproduce

Yarn 1.22.x (working)

mkdir /tmp/cypress-example-kitchensink_yarn1x cd /tmp/cypress-example-kitchensink_yarn1x git clone https://github.com/cypress-io/cypress-example-kitchensink.git cd cypress-example-kitchensink verify yarn version is 1.22.x with yarn --version yarn install yarn run cypress run You get " Running: 1-getting-started/todo.cy.js (1 of 20)"

Yarn 3.x (Not working)

mkdir /tmp/cypress-example-kitchensink_yarn3x cd /tmp/cypress-example-kitchensink_yarn3x git clone https://github.com/cypress-io/cypress-example-kitchensink.git cd cypress-example-kitchensink switch to yarn 3.x yarn set version berry or yarn set version 3.0.1 verify yarn version is 3.x with yarn --version yarn install yarn run cypress run You get the following error message

Error: Your application tried to access @opentelemetry/resources, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound.

cypress run output

yarn run cypress run (node:14330) [MODULE_NOT_FOUND] Error: debug tried to access supports-color (a peer dependency) but it isn’t provided by its ancestors; this makes the require call ambiguous and unsound. (Use node --trace-warnings ... to show where the warning was created) [14331:0812/201925.935593:ERROR:node_bindings.cc(279)] Most NODE_OPTIONs are not supported in packaged apps. See documentation for more details. [14331:0812/201925.935610:ERROR:node_bindings.cc(279)] Most NODE_OPTIONs are not supported in packaged apps. See documentation for more details. [14331:0812/201925.935614:ERROR:node_bindings.cc(279)] Most NODE_OPTIONs are not supported in packaged apps. See documentation for more details. [14331:0812/201925.935616:ERROR:node_bindings.cc(279)] Most NODE_OPTIONs are not supported in packaged apps. See documentation for more details.

DevTools listening on ws://127.0.0.1:49377/devtools/browser/9349252f-b218-422b-96a8-333b9339c723 /private/tmp/cypress-example-kitchensink_yarn3x/.pnp.cjs:22522 Error.captureStackTrace(firstError); ^

Error: Your application tried to access @opentelemetry/resources, but it isn’t declared in your dependencies; this makes the require call ambiguous and unsound.

Required package: @opentelemetry/resources Required by: /Users/tonychia/Library/Caches/Cypress/12.17.3/Cypress.app/Contents/Resources/app/packages/telemetry/dist/

Require stack:

  • /Users/tonychia/Library/Caches/Cypress/12.17.3/Cypress.app/Contents/Resources/app/packages/telemetry/dist/node.js
  • /Users/tonychia/Library/Caches/Cypress/12.17.3/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/require_async_child.js at require$$0.Module._resolveFilename (/private/tmp/cypress-example-kitchensink_yarn3x/.pnp.cjs:22522:13) at Module._load (node:internal/modules/cjs/loader:901:27) at require$$0.Module._load (/private/tmp/cypress-example-kitchensink_yarn3x/.pnp.cjs:22411:31) at Module.require (node:internal/modules/cjs/loader:1115:19) at require (node:internal/modules/helpers:130:18) at Object.<anonymous> (/Users/tonychia/Library/Caches/Cypress/12.17.3/Cypress.app/Contents/Resources/app/packages/telemetry/dist/node.js:4:21) at Module._compile (node:internal/modules/cjs/loader:1233:14) at Module._extensions…js (node:internal/modules/cjs/loader:1287:10) at require$$0.Module._extensions…js (/private/tmp/cypress-example-kitchensink_yarn3x/.pnp.cjs:22566:33) at Module.load (node:internal/modules/cjs/loader:1091:32)

Cypress Version

12.17.3

Node version

v14.21.2, v18.7.0

Operating System

Mac OSX 13.4.1

Debug Logs

No response

Other

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 24 (13 by maintainers)

Most upvoted comments

I also had one in my ~/ and removing it moved me past this. Might be useful if a check were to be added to warn people that this might cause issues.

Thanks for the help Mike!

It was a local cache issue. This issue can be resolved.

I had a .pnp.cjs file in my ~/ directory. I deleted it and now cypress is working! Thank you!