You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following the instructions in CONTRIBUTING > Getting Started should allow selecting and running an otherwise working Cypress (E2E) project using Yarn Modern pnp without error.
Cypress however fails with the error
Your configFile is invalid
and the stack trace shows
Error: Cannot find module 'cypress'
where it presumably is trying to look for cypress in the non-existent node_modules directory, that is not created for Yarn Modern pnp configurations.
Why is this needed?
Yarn Modern Plug'n'Play is the default installation strategy for new Yarn Modern installations (in which case .yarnrc.yml > nodeLinker is undefined). Setting nodeLinker explicitly to pnp also has the same effect.
It should be possible to test the WIP Cypress develop branch against a default Yarn Modern E2E project.
The --project option is not suitable here because it uses the package.jsonfile (and by implication the package manager) of the root directory. --project does not allow to use a different package manager.
Other
Steps to reproduce error
Ubuntu 24.04.1 LTS, Node.js v22.11.0
npm install yarn@latest -g
mkdir cy-yarn-pnp-test
cd cy-yarn-pnp-test
git clone https://github.com/cypress-io/github-action
cd github-action/examples/yarn-modern-pnp
yarn
cd ../../..
git clone https://github.com/cypress-io/cypress
cd cypress
n auto # or set Node.js manually according to .node-version
yarn
yarn cypress run --project ../github-action/examples/yarn-modern-pnp --dev
Logs
$ yarn cypress run --project ../github-action/examples/yarn-modern-pnp --dev
yarn run v1.22.22
$ /home/mike/github/tmp/cy-yarn-pnp-test/cypress/node_modules/.bin/cypress run --project ../github-action/examples/yarn-modern-pnp --dev
DevTools listening on ws://127.0.0.1:39029/devtools/browser/eb4abf83-1e72-4e00-a7e7-8a4844eb6198
Your configFile is invalid: /home/mike/github/tmp/cy-yarn-pnp-test/github-action/examples/yarn-modern-pnp/cypress.config.js
It threw an error when required, check the stack trace below:
Error: Cannot find module 'cypress'
Require stack:
- /home/mike/github/tmp/cy-yarn-pnp-test/github-action/examples/yarn-modern-pnp/cypress.config.js
- /home/mike/github/tmp/cy-yarn-pnp-test/cypress/packages/server/lib/plugins/child/run_require_async_child.js
- /home/mike/github/tmp/cy-yarn-pnp-test/cypress/packages/server/lib/plugins/child/require_async_child.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
at Module._load (node:internal/modules/cjs/loader:922:27)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:121:18)
at Object.<anonymous> (/home/mike/github/tmp/cy-yarn-pnp-test/github-action/examples/yarn-modern-pnp/cypress.config.js:1:26)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:121:18)
at loadFile (/home/mike/github/tmp/cy-yarn-pnp-test/cypress/packages/server/lib/plugins/child/run_require_async_child.js:89:14)
at EventEmitter.<anonymous> (/home/mike/github/tmp/cy-yarn-pnp-test/cypress/packages/server/lib/plugins/child/run_require_async_child.js:116:38)
at EventEmitter.emit (node:events:514:28)
at process.<anonymous> (/home/mike/github/tmp/cy-yarn-pnp-test/cypress/packages/server/lib/plugins/util.js:33:22)
at process.emit (node:events:514:28)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
What would you like?
Following the instructions in CONTRIBUTING > Getting Started should allow selecting and running an otherwise working Cypress (E2E) project using Yarn Modern pnp without error.
Cypress however fails with the error
and the stack trace shows
where it presumably is trying to look for
cypress
in the non-existentnode_modules
directory, that is not created for Yarn Modern pnp configurations.Why is this needed?
Yarn Modern Plug'n'Play is the default installation strategy for new Yarn Modern installations (in which case
.yarnrc.yml
>nodeLinker
is undefined). SettingnodeLinker
explicitly topnp
also has the same effect.It should be possible to test the WIP Cypress develop branch against a default Yarn Modern E2E project.
The
--project
option is not suitable here because it uses thepackage.json
file (and by implication the package manager) of the root directory.--project
does not allow to use a different package manager.Other
Steps to reproduce error
Ubuntu
24.04.1
LTS, Node.jsv22.11.0
Logs
Related
The text was updated successfully, but these errors were encountered: