github-action
github-action copied to clipboard
Error: Cannot find module 'cypress' after upgrade
After upgrading from 3 to 4 and Cypress 9 to 10, the following happens:
- name: Build frontend
if: steps.reuse-frontend-build.outputs.cache-hit != 'true'
uses: cypress-io/[email protected] # https://github.com/cypress-io/github-action
env:
DEBUG: "@cypress/github-action"
with:
working-directory: frontend
install-command: yarn --immutable
build: yarn build
runTests: false
...
The build folder is ready to be deployed.
You may serve it with a static server:
yarn global add serve
serve -s build
Find out more about deployment here:
https://cra.link/deployment
2022-08-01T19:30:07.309Z @cypress/github-action No start command found
2022-08-01T19:30:07.311Z @cypress/github-action Cannot find module 'cypress'
Require stack:
- /home/runner/work/_actions/cypress-io/github-action/v4.2.0/dist/index.js
2022-08-01T19:30:07.318Z @cypress/github-action Error: Cannot find module 'cypress'
Require stack:
- /home/runner/work/_actions/cypress-io/github-action/v4.2.0/dist/index.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
Error: Cannot find module 'cypress'
Require stack:
- /home/runner/work/_actions/cypress-io/github-action/v4.2.0/dist/index.js
at Function.resolve (node:internal/modules/cjs/helpers:108:19)
at runTests (/home/runner/work/_actions/cypress-io/github-action/v4.2.0/dist/index.js:75237:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
0s
So it's clear to me that the action successfully installed and built the code, and then what is it trying to do, why must it do something more and fail at doing that? Before this upgrade, this CI script worked fine (with action v3 and cy 9).
BTW we're using Yarn 2 PnP. Starting to think about rolling back to a regular node_modules
setup. This PnP thing made so many things so much more difficult, especially with Cypress when we first implemented it a year ago!
While keeping Cypress 10 and reverting this action to v3 just like explained in this other issue, we got our tests working again here.
- name: Build frontend
if: steps.reuse-frontend-build.outputs.cache-hit != 'true'
uses: cypress-io/[email protected] # https://github.com/cypress-io/github-action
env:
DEBUG: "@cypress/github-action"
with:
working-directory: frontend
config-file: cypress.config.js # until cypress-io/github-action@v4 is fixed for our setup...
install-command: yarn --immutable
build: yarn build
runTests: false
Obviously, this is weird, as v4 was released to bring support for Cy 10, but seems to break it instead in our case.
:tada: This issue has been resolved in version 5.7.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
@delyada
Please check out Yarn Plug'n'Play and see if it meets your needs. This is new functionality contributed by @PilotConway.