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

Module 'cypress' not found using Yarn v4 #1353

Closed
arielmoguillansky opened this issue Jan 29, 2025 · 2 comments
Closed

Module 'cypress' not found using Yarn v4 #1353

arielmoguillansky opened this issue Jan 29, 2025 · 2 comments
Assignees

Comments

@arielmoguillansky
Copy link

arielmoguillansky commented Jan 29, 2025

Hi! I'm trying to trigger cypress component in a nextjs project with actions.
This is the following yml:

name: Cypress Tests
on:
  pull_request:
    branches:
      - main
      - develop
jobs:
  cypress-run:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 18
      - name: Enable Corepack
        run: corepack enable
      - name: Install dependencies
        run: yarn install
      - name: Run Cypress tests
        uses: cypress-io/[email protected]
        with:
          component: true
          browser: chrome

And the following error

Run cypress-io/github-action@v6
Received 83886080 of [17](https://github.com/ForaTravel/fora-website/actions/runs/13030631408/job/36348900903#step:6:18)9777809 (46.7%), 79.9 MBs/sec
Cache Size: ~171 MB (179777809 B)
/usr/bin/tar -xf /home/runner/work/_temp/15d5454b-b973-44be-919b-36d64496dbca/cache.tzst -P -C /home/runner/work/fora-website/fora-website --use-compress-program unzstd
Received 179777809 of 179777809 (100.0%), 85.6 MBs/sec
Cache restored successfully
/opt/hostedtoolcache/node/[18](https://github.com/ForaTravel/fora-website/actions/runs/13030631408/job/36348900903#step:6:19).20.6/x64/bin/yarn --frozen-lockfile
➤ YN0050: The --frozen-lockfile option is deprecated; use --immutable and/or --immutable-cache instead

➤ YN0000: · Yarn 4.3.0
➤ YN0000: ┌ Resolution step
Resolution step
➤ YN0000: └ Completed in 0s 454ms
➤ YN0000: ┌ Post-resolution validation
Post-resolution validation
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
Fetch step
➤ YN0000: └ Completed in 1s 718ms
➤ YN0000: ┌ Link step
Link step
➤ YN0000: └ Completed in 0s 267ms
➤ YN0000: · Done with warnings in 2s 762ms
/opt/hostedtoolcache/node/18.20.6/x64/bin/npx cypress cache list
npm warn exec The following package was not found and will be installed: [email protected]
┌─────────┬───────────────────┐
│ version │ last used         │
├─────────┼───────────────────┤
│ 14.0.0  │ a few seconds ago │
├─────────┼───────────────────┤
│ 14.0.1  │ [19](https://github.com/ForaTravel/fora-website/actions/runs/13030631408/job/36348900903#step:6:20) hours ago      │
└─────────┴───────────────────┘
/opt/hostedtoolcache/node/18.20.6/x64/bin/npx cypress verify

[STARTED] Task without title.
[SUCCESS] Task without title.
Saving npm cache error: Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.
/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/fora-website/fora-website --files-from manifest.txt --use-compress-program zstdmt
Failed to save: Unable to reserve cache with key cypress-linux-x64-a9b8b839e660cd[21](https://github.com/ForaTravel/fora-website/actions/runs/13030631408/job/36348900903#step:6:22)36b70922d7cdd87473b62ba1a1f9ba0f77ce9f3944ad5329b6b2b682bf84d9fb7330aa570f56d18c19f08f328812a15ceced577004b1f7bb, another job may be creating this cache. More details: Cache already exists. Scope: refs/pull/1984/merge, Key: cypress-linux-x64-a9b8b839e660cd2136b709[22](https://github.com/ForaTravel/fora-website/actions/runs/13030631408/job/36348900903#step:6:23)d7cdd87473b62ba1a1f9ba0f77ce9f3944ad5329b6b2b682bf84d9fb7330aa570f56d18c19f08f328812a15ceced577004b1f7bb, Version: 1955096f8dd018efdf62615d0a27779c95e9b0287a6a71bc18[23](https://github.com/ForaTravel/fora-website/actions/runs/13030631408/job/36348900903#step:6:24)56f3b1a36196
Error: Cannot find module 'cypress'
Require stack:
- /home/runner/work/_actions/cypress-io/github-action/v6/dist/index.js

Tried by adding install-command as the docs suggest but no luck

      - name: Run Cypress tests
        uses: cypress-io/[email protected]
        with:
          component: true
          browser: chrome
          install-command: yarn install

Any help will be much appreciated!

@arielmoguillansky
Copy link
Author

Solved: must include .yarnrc with the nodeLinker prop

@MikeMcC399
Copy link
Collaborator

@arielmoguillansky

It's good to see you solved your problem!

We've just updated the documentation on https://docs.cypress.io/app/get-started/install-cypress#Package-Manager to make it clear that you need nodeLinker: node-modules for Component Testing.

@MikeMcC399 MikeMcC399 self-assigned this Jan 29, 2025
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

2 participants