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

Fails if using pnpm #145

Closed
FFdhorkin opened this issue May 27, 2020 · 13 comments · Fixed by #586
Closed

Fails if using pnpm #145

FFdhorkin opened this issue May 27, 2020 · 13 comments · Fixed by #586
Assignees
Labels

Comments

@FFdhorkin
Copy link

We are using pnpm (https://pnpm.js.org/) with our project. As such, we do not have a package-lock.json file. Even setting install to false fails with the cypress github action (see below).

Pnpm uses a pnpm-lock.yaml file that serves the same purpose, and generally (though not always) has the same syntax as npm. However, the lockfile formats are not compatible.

This action installs local dependencies using lock files. If yarn.lock file is found, the install uses yarn --frozen-lockfile command. Otherwise it expects to find package-lock.json and install using npm ci command.

internal/fs/utils.js:220
    throw err;
    ^

Error: ENOENT: no such file or directory, open 'package-lock.json'
    at Object.openSync (fs.js:440:3)
    at Object.readFileSync (fs.js:342:35)
    at Function.module.exports.309.hasha.fromFileSync (/home/runner/work/_actions/cypress-io/github-action/v1.16.1/dist/index.js:4439:54)
    at Object.104 (/home/runner/work/_actions/cypress-io/github-action/v1.16.1/dist/index.js:2440:24)
    at __webpack_require__ (/home/runner/work/_actions/cypress-io/github-action/v1.16.1/dist/index.js:22:30)
    at startup (/home/runner/work/_actions/cypress-io/github-action/v1.16.1/dist/index.js:37:19)
    at /home/runner/work/_actions/cypress-io/github-action/v1.16.1/dist/index.js:41:18
    at Object.<anonymous> (/home/runner/work/_actions/cypress-io/github-action/v1.16.1/dist/index.js:44:10)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: 'package-lock.json'
}

If relevant, there is a github action for pnpm: https://github.com/marketplace/actions/setup-pnpm
They also have these docs that might be relevant: https://pnpm.js.org/en/continuous-integration

@jennifer-shehane
Copy link
Member

We would be open to PR to fix this. This would be pretty low priority for us to address ourselves since we have very few pnpm users.

@FFdhorkin
Copy link
Author

I'll see if I can find some time to do that. I imagine it'll be a relatively simple PR.

@FFdhorkin
Copy link
Author

Sorry for the delay. I've done most of the work for this PR, but I'm getting errors related to the cache dependency. I also see this locally - there's no cache/lib/index.

Is the DEVELOPMENT.md missing a step?

image

image

If needed, you can peek at my WIP implementation of PNPM support for Cypress's github action here: https://github.com/FFdhorkin/github-action/tree/feature/pnpm-support

As an additional note, the actions unrelated to pnpm are failing at the same place. However, example-recording / basic fails and yet gets marked as success: https://github.com/FFdhorkin/github-action/runs/1033660717?check_suite_focus=true

@FFdhorkin
Copy link
Author

@bahmutov any idea why I'm getting that import error?

@bahmutov
Copy link
Contributor

Could you rebase from the latest code - we have started using the official actions/cache NPM dependency, so this error should be gone.

@bahmutov bahmutov added the help wanted Extra attention is needed label Nov 23, 2020
@tnrich
Copy link

tnrich commented Mar 18, 2021

@FFdhorkin seems close! Would be much appreciated if you could fix this :)

tnrich added a commit to TeselaGen/teselagen-react-components that referenced this issue Mar 18, 2021
@penx
Copy link

penx commented May 31, 2021

I've rebased off master and opened a draft PR #381

https://github.com/penx/github-action/actions/runs/892619945

This currently fails with

Unable to process command '::add-path::/home/runner/setup-pnpm/.bin' successfully.

The `add-path` command is disabled. Please upgrade to using Environment Files or opt into unsecure command execution by setting the `ACTIONS_ALLOW_UNSECURE_COMMANDS` environment variable to `true`.

@penx
Copy link

penx commented May 31, 2021

I've also opened a draft PR #382 to solve a similar issue using npm workspaces #377 that allows the lock file path to be specified, but it currently errors with this:

The `npm ci` command can only install with an existing package-lock.json

@fc1943s
Copy link

fc1943s commented Jul 20, 2021

Just installed pnpm and got blocked by this ;(
I was using yarn before, and it was working, even though the image specifies that the github action is expecting npm's package-lock.json file.

image

@penx is there a way of using your draft branch for now, changing - uses: cypress-io/github-action@v2 for - uses: penx/github-action@4c488bcaa610e82cc1b45c3b0ac935e415fc6e59 or something like that?

@tcrwt
Copy link

tcrwt commented Jul 22, 2021

I got stuck on this but running the pnpm install and cypress separately seemed to resolve it. It's possible this isn't the best way but it got things working!

- name: Set up pnpm
  uses: pnpm/action-setup@v2.0.1
  with:
    version: 6
    # Only install what we need to run the client in-action and tests against it
    # format:    `--filter <packagename>...`
    run_install: |
      - args: [--filter myclient... --filter cypress-tests...]

- name: Run Cypress tests
  uses: cypress-io/github-action@v2
  with:
    # we have already installed all dependencies above
    install: false
    command: pnpm --dir cypress/ cypress:ci
    start: pnpm --dir myclient/ dev
    wait-on: 'https://localhost:3000'

@DavidWells
Copy link

I also just ran into this. We are using pnpm for faster installs.

Whats odd is /home/runner/work/clients/clients/src/app/package-lock.json seems like the wrong path (notice the double client in that path). It seems like it should be looking for /home/runner/work/clients/src/app/package-lock.json (correct path single clients). But yeah no package-lock.json would exist there either.

internal/fs/utils.js:220
    throw err;
    ^

Error: ENOENT: no such file or directory, open '/home/runner/work/clients/clients/src/app/package-lock.json'
    at Object.openSync (fs.js:440:3)
    at Object.readFileSync (fs.js:342:35)
    at Function.module.exports.hasha.fromFileSync (/home/runner/work/_actions/cypress-io/github-action/v2/dist/index.js:18048:54)
    at lockHash (/home/runner/work/_actions/cypress-io/github-action/v2/dist/index.js:6729:26)
    at getNpmCache (/home/runner/work/_actions/cypress-io/github-action/v2/dist/index.js:6739:16)
    at restoreCachedNpm (/home/runner/work/_actions/cypress-io/github-action/v2/dist/index.js:6784:21)
    at installMaybe (/home/runner/work/_actions/cypress-io/github-action/v2/dist/index.js:7365:5)
    at Object.<anonymous> (/home/runner/work/_actions/cypress-io/github-action/v2/dist/index.js:7388:1)
    at __webpack_require__ (/home/runner/work/_actions/cypress-io/github-action/v2/dist/index.js:24:31)
    at startup (/home/runner/work/_actions/cypress-io/github-action/v2/dist/index.js:43:19) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/home/runner/work/clients/clients/src/app/package-lock.json'
}

Setting install: false to false fixes this for us

@kitsune7 kitsune7 mentioned this issue Dec 7, 2021
exbotanical added a commit to exbotanical/uxc that referenced this issue Mar 15, 2022
the cypress test runner fails in ci environments. see
cypress-io/github-action#145 et al. @todo try a
different package manager later
@Kocal
Copy link
Contributor

Kocal commented Jul 25, 2022

A PR has been opened #586

@github-actions
Copy link

🎉 This issue has been resolved in version 4.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants