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

The cypress npm package is installed, but the Cypress binary is missing. #1246

Open
kostiantynvoiku opened this issue Sep 2, 2024 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@kostiantynvoiku
Copy link

This happens whenever a new version of Cypress is released.

I have a locked version 13.14.0 in package.json, but the runner installs the latest version and as a result Cypress fails with the error message:
The cypress npm package is installed, but the Cypress binary is missing.
We expected the binary to be installed here: /home/runner/.cache/Cypress/13.14.0/Cypress/Cypress

packages/packageName/package.json
  "devDependencies": {
    "cypress": "13.14.0"
     ...
pnpm-lock.yaml
      cypress:
        specifier: 13.14.0
        version: 13.14.0
        ...

My workflow steps:

      - name: "Setup pnpm packageManager"
        uses: pnpm/action-setup@v4

      - name: "Setup NodeJS environment"
        uses: actions/setup-node@v4
        with:
          node-version: "lts/*"
          registry-url: "https://npm.pkg.github.com"
          cache: "pnpm"

      - name: "Run E2E tests"
        uses: cypress-io/github-action@v6
        with:
          command: pnpm -F ${{ inputs.package-name }} cy:run
image image
@MikeMcC399 MikeMcC399 added the bug Something isn't working label Sep 2, 2024
@MikeMcC399
Copy link
Collaborator

MikeMcC399 commented Sep 2, 2024

@kostiantynvoiku

It looks like you may be using pnpm workspaces. Please note that there is no native support in the action for this (see #1144). You can check the example in the README https://github.com/cypress-io/github-action/blob/master/README.md#pnpm-workspaces for a way to work around this, by splitting dependency installation and running Cypress.

You are using command to run Cypress which by-passes a lot of the functionality of the action. Again, you may like to look at the example to see if that would help.

I could not see the root cause of your problem from the information you provided however, so if you want to dig in to what is happening, then you would need to enable debugging (see https://github.com/cypress-io/github-action/blob/master/README.md#debugging) probably also with ACTIONS_STEP_DEBUG.

If you are able to provide a public online repro of this issue, we could also look at it in parallel.

@kostiantynvoiku
Copy link
Author

@MikeMcC399, thank you, I've tried a few solutions suggested in similar issues related to pnpm workspaces and got it fixed by using the solution of adding a step for caching the cache/Cypress folder and splitting dependency installation + running Cypress:

      - uses: pnpm/action-setup@v4

      - uses: actions/setup-node@v4
        with:
          node-version: "lts/*"
          registry-url: "https://npm.pkg.github.com"
          cache: "pnpm"

      - uses: actions/cache@v4
        with:
          path: ~/.cache/Cypress
          key: cypress-${{ runner.os }}-cypress-${{ hashFiles('pnpm-lock.yaml') }}

      - run: pnpm i --frozen-lockfile
     
      - uses: cypress-io/github-action@v6
        with:
          install: false
          working-directory: packages/${{ inputs.package-name }}
          command: pnpm run cy:run

@MikeMcC399
Copy link
Collaborator

@kostiantynvoiku

It's good to hear you were able to solve your issue! Thanks for your feedback!

@MikeMcC399 MikeMcC399 self-assigned this Sep 3, 2024
@kostiantynvoiku
Copy link
Author

Cypress recently has released a new version, so my all my jobs failed again, as the runner installs the latest version 😞

Cypress version locked in the project:

packages/mypkg/package.json
  "devDependencies": {
    "cypress": "13.14.1"
     ...
pnpm-lock.yaml
      cypress:
        specifier: 13.14.1
        version: 13.14.1
        ...

My workflow steps:

      - name: "Setup pnpm packageManager"
        uses: pnpm/action-setup@v4

      - name: "Setup NodeJS environment"
        uses: actions/setup-node@v4
        with:
          node-version: "lts/*"
          registry-url: "https://npm.pkg.github.com"
          cache: "pnpm"

      - name: "Set up Cypress binary cache"
        uses: actions/cache@v4
        with:
          path: ~/.cache/Cypress
          key: cypress-${{ runner.os }}-cypress-${{ hashFiles('pnpm-lock.yaml') }}

      - name: "Install dependencies"
        uses: cypress-io/github-action@v6
        with:
          runTests: false

      - name: "Run E2E tests"
        uses: cypress-io/github-action@v6
        with:
          install: false
          working-directory: packages/${{ inputs.package-name }}
          command: pnpm run cy:run

Job logs:

 ➡️ Set up Cypress binary cache:
Run actions/cache@v4
Cache not found for input keys: cypress-Linux-cypress-4c478d334c6305cdcae0b2a7624e6bd5e005b8b95944abe39d4c3582df7fe94b


➡️ Install dependencies:
Run cypress-io/github-action@v6
  with:
    runTests: false
    record: false
    publish-summary: true
    component: false
2024-09-05T06:13:39.671Z @cypress/github-action working directory /home/runner/work/my-repo
2024-09-05T06:13:39.672Z @cypress/github-action using custom Cypress cache folder "/home/runner/.cache/Cypress"
2024-09-05T06:13:39.672Z @cypress/github-action trying to restore cached npm modules
2024-09-05T06:13:39.674Z @cypress/github-action Hash from file /home/runner/work/my-repo/pnpm-lock.yaml is 2590ded5ba184b50bfd49a100bdd56eb113dd7b4c51e0c94c14d190d0604c37691db08532c2aa6c0a9cccfeba339f65f5c08d4f2500abdd607b1a025cdbb30a7
2024-09-05T06:13:39.677Z @cypress/github-action trying to restore cached Cypress binary
2024-09-05T06:13:39.678Z @cypress/github-action Hash from file /home/runner/work/my-repo/pnpm-lock.yaml is 2590ded5ba184b50bfd49a100bdd56eb113dd7b4c51e0c94c14d190d0604c37691db08532c2aa6c0a9cccfeba339f65f5c08d4f2500abdd607b1a025cdbb30a7
Received 0 of 172839411 (0.0%), 0.0 MBs/sec
Received 1351632 of 13934544 (9.7%), 1.3 MBs/sec
Received 13934544 of 13934544 (100.0%), 9.9 MBs/sec
Cache Size: ~13 MB (13934544 B)
/usr/bin/tar -xf /home/runner/work/_temp/8789c491-6d4c-458a-b2f1-dc7f2ac77410/cache.tzst -P -C /home/runner/work/my-repo --use-compress-program unzstd
Received 79691776 of 172839411 (46.1%), 37.9 MBs/sec
Cache restored successfully
Received 168645107 of 172839411 (97.6%), 53.5 MBs/sec
Received 172839411 of 172839411 (100.0%), 53.5 MBs/sec
Cache Size: ~165 MB (172839411 B)
/usr/bin/tar -xf /home/runner/work/_temp/8e0263a4-b22e-417e-8be7-d9e316dfb105/cache.tzst -P -C /home/runner/work/my-repo --use-compress-program unzstd
Cache restored successfully
2024-09-05T06:13:46.701Z @cypress/github-action npm cache hit pnpm-linux-x64-2590ded5ba184b50bfd49a100bdd56eb113dd7b4c51e0c94c14d190d0604c37691db08532c2aa6c0a9cccfeba339f65f5c08d4f2500abdd607b1a025cdbb30a7
2024-09-05T06:13:46.701Z @cypress/github-action cypress cache hit cypress-linux-x64-2590ded5ba184b50bfd49a100bdd56eb113dd7b4c51e0c94c14d190d0604c37691db08532c2aa6c0a9cccfeba339f65f5c08d4f2500abdd607b1a025cdbb30a7
2024-09-05T06:13:46.702Z @cypress/github-action installing npm dependencies using pnpm
2024-09-05T06:13:46.704Z @cypress/github-action pnpm at "/home/runner/setup-pnpm/node_modules/.bin/pnpm"
/home/runner/setup-pnpm/node_modules/.bin/pnpm install --frozen-lockfile
Scope: all 13 workspace projects
Lockfile is up to date, resolution step is skipped
Progress: resolved 1, reused 0, downloaded 0, added 0
Packages: +2080
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 2080, reused 0, downloaded 0, added 0
Packages are hard linked from the content-addressable store to the virtual store.
  Content-addressable store is at: /home/runner/setup-pnpm/node_modules/.bin/store/v3
  Virtual store is at:             node_modules/.pnpm
Progress: resolved 2080, reused 188, downloaded 0, added 186
Progress: resolved 2080, reused 352, downloaded 0, added 348
Progress: resolved 2080, reused 495, downloaded 0, added 487
Progress: resolved 2080, reused 535, downloaded 0, added 538
Progress: resolved 2080, reused 615, downloaded 0, added 617
Progress: resolved 2080, reused 884, downloaded 0, added 893
Progress: resolved 2080, reused 1191, downloaded 0, added 1214
Progress: resolved 2080, reused 1442, downloaded 0, added 1465
Progress: resolved 2080, reused 1809, downloaded 0, added 1845
Progress: resolved 2080, reused 2000, downloaded 0, added 2044
Progress: resolved 2080, reused 2023, downloaded 0, added 2067
Progress: resolved 2080, reused 2036, downloaded 0, added 2067
Progress: resolved 2080, reused 2036, downloaded 0, added 2073
Progress: resolved 2080, reused 2036, downloaded 0, added 2080, done
....
Done in 16.5s
2024-09-05T06:14:03.3[32](https://github.com/my-repo/actions/runs/10714892904/job/29709366326#step:9:33)Z @cypress/github-action install has finished
2024-09-05T06:14:03.332Z @cypress/github-action Cypress versions in the cache folder /home/runner/.cache/Cypress
/opt/hostedtoolcache/node/20.17.0/x64/bin/npx cypress cache list
┌─────────┬───────────────────┐
│ version │ last used         │
├─────────┼───────────────────┤
│ 13.14.2 │ a few seconds ago │
└─────────┴───────────────────┘
2024-09-05T06:14:08.856Z @cypress/github-action no need to verify Cypress binary or save caches
2024-09-05T06:14:08.856Z @cypress/github-action No start command found
2024-09-05T06:14:08.857Z @cypress/github-action all done, exiting
Skipping running tests: runTests parameter is false


➡️ Run E2E tests:
Run cypress-io/github-action@v6
  with:
    install: false
    working-directory: packages/mypkg
    command: pnpm run cy:run
    record: false
    publish-summary: true
    component: false
2024-09-05T06:14:09.043Z @cypress/github-action working directory /home/runner/work/my-repo/packages/mypkg
2024-09-05T06:14:09.045Z @cypress/github-action using custom Cypress cache folder "/home/runner/.cache/Cypress"
Skipping install because install parameter is false
current working directory "/home/runner/work/my-repo/packages/mypkg"
Using custom test command: pnpm run cy:run
run tests command "pnpm run cy:run"
2024-09-05T06:14:09.050Z @cypress/github-action parsed command: pnpm run cy:run
current working directory "/home/runner/work/my-repo/packages/mypkg"
/home/runner/setup-pnpm/node_modules/.bin/pnpm run cy:run
> @my-repo/mypkg: cy:run /home/runner/work/my-repo/packages/mypkg
> cypress run --e2e --browser electron

The cypress npm package is installed, but the Cypress binary is missing.

We expected the binary to be installed here: /home/runner/.cache/Cypress/13.14.1/Cypress/Cypress

Reasons it may be missing:

- You're caching 'node_modules' but are not caching this path: /home/runner/.cache/Cypress
- You ran 'npm install' at an earlier build step but did not persist: /home/runner/.cache/Cypress

Properly caching the binary will fix this error and avoid downloading and unzipping Cypress.

Alternatively, you can run 'cypress install' to download the binary again.

https://on.cypress.io/not-installed-ci-error

----------

Platform: linux-x[64](https://github.com/my-repo/actions/runs/10714892904/job/29709366326#step:11:65) (Ubuntu - 22.04)
Cypress Version: 13.14.1
 ELIFECYCLE  Command failed with exit code 1.
2024-09-05T06:14:09.842Z @cypress/github-action The process '/home/runner/setup-pnpm/node_modules/.bin/pnpm' failed with exit code 1
2024-09-05T06:14:09.846Z @cypress/github-action Error: The process '/home/runner/setup-pnpm/node_modules/.bin/pnpm' failed with exit code 1
    at ExecState._setResult (/home/runner/work/_actions/cypress-io/github-action/v6/dist/index.js:3900:25)
    at ExecState.CheckComplete (/home/runner/work/_actions/cypress-io/github-action/v6/dist/index.js:3883:18)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/cypress-io/github-action/v6/dist/index.js:3777:27)
    at ChildProcess.emit (node:events:519:28)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)
Error: The process '/home/runner/setup-pnpm/node_modules/.bin/pnpm' failed with exit code 1

@MikeMcC399
Copy link
Collaborator

@kostiantynvoiku

I'm sorry to hear that you are hit with the same issue again.

Looking at the information provided I don't see the reason for your problem, so I suggest again to enable debugging (see https://github.com/cypress-io/github-action/blob/master/README.md#debugging) also with ACTIONS_STEP_DEBUG.

Once again also, if you are able to provide a public online repro of this issue, we could also look at it in parallel.

@saeta-eth
Copy link

I'm also hitting the same issue and had to downgrade from 6.7.5 to 6.7.4 to make it work. Since the project is open source, it might be helpful if you want to debug the problem. I got this error in the following PR: usecannon/cannon#1355.

Thank you, and I hope this helps! Let me know if I can provide more information to resolve this.

@MikeMcC399
Copy link
Collaborator

@saeta-eth

  • The action does not explicity support pnpm workspaces and this issue is most probably caused by the combination of custom workflows with caching and the action's caching. So it is not specifically a bug in the action which can be fixed in the action. The enhancement request Add workspace support for pnpm #1144 remains open at this time.

  • There were no caching changes in the action between 6.7.4 and 6.7.5 so it is probably coincidence that downgrading helped.

  • You may be able to add a manual step pnpm exec cypress install into your workflow which will install the Cypress binary if it is not already installed.

@kostiantynvoiku
Copy link
Author

kostiantynvoiku commented Sep 6, 2024

@MikeMcC399

I suggest again to enable debugging (see master/README.md#debugging) also with ACTIONS_STEP_DEBUG.

The logs I posted above are with enabled debugging.

if you are able to provide a public online repro of this issue, we could also look at it in parallel.

I'll try to create a sample public repo similar to the one I'm getting the issue.

For now I fixed the issue with the following workaround:

- uses: actions/cache@v4
  with:
    path: ~/.cache/Cypress
    key: cypress-${{ runner.os }}-cypress-${{ hashFiles('pnpm-lock.yaml') }}

- uses: cypress-io/github-action@v6
  with:
    runTests: false
    
- run: pnpm cypress verify || pnpm cypress install
  working-directory: packages/${{ inputs.package-name }}
     
- uses: cypress-io/github-action@v6
  with:
    install: false
    working-directory: packages/${{ inputs.package-name }}
    command: pnpm run cy:run

@MikeMcC399
Copy link
Collaborator

@kostiantynvoiku

  • If it is working for you with the addition of pnpm cypress install in your workflow that is probably the best we can expect at this time considering that pnpm workspaces are not explicitly supported by the action.

  • You are welcome to post a public repo if you think that there is a bug in the action, however my guess is that there is little scope for improving the action unless the enhancement request Add workspace support for pnpm #1144 is implemented.

mikavilpas added a commit to mikavilpas/blink-ripgrep.nvim that referenced this issue Nov 15, 2024
mikavilpas added a commit to mikavilpas/blink-ripgrep.nvim that referenced this issue Nov 15, 2024
mikavilpas added a commit to mikavilpas/tui-sandbox that referenced this issue Nov 23, 2024
https://github.com/mikavilpas/tui-sandbox/actions/runs/11981839398/job/33408806661?pr=155

> /opt/hostedtoolcache/node/20.17.0/x64/bin/npx cypress cache list
> No cached binary versions were found.
> /opt/hostedtoolcache/node/20.17.0/x64/bin/npx cypress verify
> The cypress npm package is installed, but the Cypress binary is missing.
>
> We expected the binary to be installed here: /home/runner/.cache/Cypress/13.16.0/Cypress/Cypress
>
> Reasons it may be missing:
>
> - You're caching 'node_modules' but are not caching this path: /home/runner/.cache/Cypress
> - You ran 'npm install' at an earlier build step but did not persist: /home/runner/.cache/Cypress
>
> Properly caching the binary will fix this error and avoid downloading and unzipping Cypress.
>
> Alternatively, you can run 'cypress install' to download the binary again.
>
> https://on.cypress.io/not-installed-ci-error

cypress-io/github-action#1246
mikavilpas added a commit to mikavilpas/tui-sandbox that referenced this issue Nov 23, 2024
https://github.com/mikavilpas/tui-sandbox/actions/runs/11981839398/job/33408806661?pr=155

> /opt/hostedtoolcache/node/20.17.0/x64/bin/npx cypress cache list
> No cached binary versions were found.
> /opt/hostedtoolcache/node/20.17.0/x64/bin/npx cypress verify
> The cypress npm package is installed, but the Cypress binary is missing.
>
> We expected the binary to be installed here: /home/runner/.cache/Cypress/13.16.0/Cypress/Cypress
>
> Reasons it may be missing:
>
> - You're caching 'node_modules' but are not caching this path: /home/runner/.cache/Cypress
> - You ran 'npm install' at an earlier build step but did not persist: /home/runner/.cache/Cypress
>
> Properly caching the binary will fix this error and avoid downloading and unzipping Cypress.
>
> Alternatively, you can run 'cypress install' to download the binary again.
>
> https://on.cypress.io/not-installed-ci-error

cypress-io/github-action#1246
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants