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

Error: The process '/usr/local/bin/npx' failed with exit code 1 #211

Closed
stoplion opened this issue Oct 23, 2020 · 18 comments · Fixed by #220
Closed

Error: The process '/usr/local/bin/npx' failed with exit code 1 #211

stoplion opened this issue Oct 23, 2020 · 18 comments · Fixed by #220
Labels
bug Something isn't working question Further information is requested released

Comments

@stoplion
Copy link

Using version 5.4.0 Cypress

Getting a ..
Error: The process '/usr/local/bin/npx' failed with exit code 1

@bahmutov
Copy link
Contributor

bahmutov commented Oct 23, 2020 via email

@bahmutov bahmutov added the question Further information is requested label Oct 26, 2020
@andersravn
Copy link

We are also experiencing this today. These are the logs:

Run cypress-io/github-action@v2
/usr/bin/yarn --frozen-lockfile
yarn install v1.22.5
[1/4] Resolving packages...
success Already up-to-date.
Done in 1.30s.
/usr/local/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/5.0.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

----------

Platform: linux (Ubuntu - 18.04)
Cypress Version: 5.0.0
Error: The process '/usr/local/bin/npx' failed with exit code 1

Looking at the changes we've made since Friday, where it last worked, I don't expect it to be something on our end. I'll try to double-check.

@miohtama
Copy link

miohtama commented Oct 28, 2020

I am not sure if related but starting to see "cannot run binary errors" as well very recently.

(node:28066) UnhandledPromiseRejectionWarning: Error: There was an error when attempting to execute the process '/usr/local/bin/npm'. This may indicate the process failed to start. Error: spawn /usr/local/bin/npm ENOENT

With the following receipt

    - name: Cypress run
      uses: cypress-io/github-action@v2
      with:
        working-directory: ./frontend_new
        build: npm run build:testing
        start: npm run start:integration-test-server
        record: true
      env:
        CI: true
        # pass the Dashboard record key as an environment variable
        CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}

Almost looks like PATH or /usr/bin is destroyed between build and start steps. npm works in build, but no longer in start.

Still diagnosing the issue.

@bausmeier
Copy link

We're seeing the exact same error as @miohtama, except with yarn instead of npm. Haven't managed to do any further digging.

Our config is:

- name: Install dependencies
  run: yarn install --frozen-lockfile
- name: Check formatting
  run: yarn run format:check
- name: Run Cypress
  uses: cypress-io/github-action@v2
  with:
    working-directory: web
    install: false
    start: yarn serve

@miohtama
Copy link

It is a regression in Cypress action. I do not know what or where.

I fixed by pinning down Cypress action to an earlier version:

    - name: Cypress run
      uses: cypress-io/[email protected]

@bahmutov
Copy link
Contributor

The explicit version pin by is a good solution for now

Can someone run with https://github.com/cypress-io/github-action#debugging flags on and paste the full log up to the error? I wonder if the new caching does not restore the caches correctly and thus fails to run.

@bahmutov bahmutov added the bug Something isn't working label Oct 28, 2020
@andersravn
Copy link

These are the full logs:

##[debug]Evaluating condition for step: 'Run Cypress tests'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Run Cypress tests
##[debug]Loading inputs
##[debug]Loading env
Run cypress-io/github-action@v2
##[debug]using custom Cypress cache folder "/home/runner/.cache/Cypress"
##[debug]trying to restore cached NPM modules
##[debug]Resolved Keys:
##[debug]["yarn-linux-x64-aec53dd3b6aac2e7a22939bba0e5544fd1627c47da090ee55424ff1b611e431577f779508b0f286f061e48b3d4276595892aabd617b42223280322a2d5c04ab9","yarn-linux-x64-aec53dd3b6aac2e7a22939bba0e5544fd1627c47da090ee55424ff1b611e431577f779508b0f286f061e48b3d4276595892aabd617b42223280322a2d5c04ab9"]
##[debug]Checking zstd --version
##[debug]trying to restore cached Cypress binary
##[debug]Resolved Keys:
##[debug]["cypress-linux-x64-aec53dd3b6aac2e7a22939bba0e5544fd1627c47da090ee55424ff1b611e431577f779508b0f286f061e48b3d4276595892aabd617b42223280322a2d5c04ab9","cypress-linux-x64-"]
##[debug]Checking zstd --version
##[debug]*** zstd command line interface 64-bits v1.3.3, by Yann Collet ***
##[debug]Resource Url: https://artifactcache.actions.githubusercontent.com/unXnoT28Ujd51XGkHKvRiknbRjBHSINEuQHH9ZKiLa70N5bhjm/_apis/artifactcache/cache?keys=yarn-linux-x64-aec53dd3b6aac2e7a22939bba0e5544fd1627c47da090ee55424ff1b611e431577f779508b0f286f061e48b3d4276595892aabd617b42223280322a2d5c04ab9%2Cyarn-linux-x64-aec53dd3b6aac2e7a22939bba0e5544fd1627c47da090ee55424ff1b611e431577f779508b0f286f061e48b3d4276595892aabd617b42223280322a2d5c04ab9&version=db8d7573c9c1e018880f416d1266a74a2aca6c42332d4f92d877cf07990531be
##[debug]*** zstd command line interface 64-bits v1.3.3, by Yann Collet ***
##[debug]Resource Url: https://artifactcache.actions.githubusercontent.com/unXnoT28Ujd51XGkHKvRiknbRjBHSINEuQHH9ZKiLa70N5bhjm/_apis/artifactcache/cache?keys=cypress-linux-x64-aec53dd3b6aac2e7a22939bba0e5544f286f061e48b3d4276595892aabd617b42223280322a2d5c04ab9%2Ccypress-linux-x64-&version=1955096f8dd0181bc182356f3b1a36196
##[debug]npm cache hit undefined
##[debug]cypress cache hit undefined
##[debug]installing NPM dependencies using Yarn
##[debug]yarn at "/usr/bin/yarn"
/usr/bin/yarn --frozen-lockfile
yarn install v1.22.5
[1/4] Resolving packages...
success Already up-to-date.
Done in 1.40s.
##[debug]Verifying Cypress
/usr/local/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/5.0.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

----------

Platform: linux (Ubuntu - 18.04)
Cypress Version: 5.0.0
##[debug]The process '/usr/local/bin/npx' failed with exit code 1
##[debug]Error: The process '/usr/local/bin/npx' failed with exit code 1
##[debug]    at ExecState._setResult (/home/runner/work/_actions/cypress-io/github-action/v2/dist/index.js:1293:25)
##[debug]    at ExecState.CheckComplete (/home/runner/work/_actions/cypress-io/github-action/v2/dist/index.js:1276:18)
##[debug]    at ChildProcess.<anonymous> (/home/runner/work/_actions/cypress-io/github-action/v2/dist/index.js:1170:27)
##[debug]    at ChildProcess.emit (events.js:210:5)
##[debug]    at maybeClose (internal/child_process.js:1021:16)
##[debug]    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
Error: The process '/usr/local/bin/npx' failed with exit code 1
##[debug]Node Action run completed with exit code 1
##[debug]CI='1'
##[debug]CYPRESS_CACHE_FOLDER='/home/runner/.cache/Cypress'
##[debug]CYPRESS_CACHE_FOLDER='/home/runner/.cache/Cypress'
##[debug]Finishing: Run Cypress tests

I modified the "keys" in there because I wasn't sure if they were secret.

@bahmutov
Copy link
Contributor

Hmm, so weird, this is working in all examples in https://github.com/bahmutov/cypress-gh-action-example

Does anyone have a public repo showing the problem?

@andersravn what the version of Cypress specified in the package.json file? Is it exact or does it use ~ or ^ or * range by any chance?

@bahmutov
Copy link
Contributor

@andersravn can you post your full workflow file, I wonder if there is something else going, and if it does not actually install Cypress binary while doing yarn command

@hrgui
Copy link

hrgui commented Oct 28, 2020

I have the same problem except with yarn. yarn install works.

(node:2922) UnhandledPromiseRejectionWarning: Error: There was an error when attempting to execute the process '/usr/bin/yarn'. This may indicate the process failed to start. Error: spawn /usr/bin/yarn ENOENT

I'll see if I can repo this in a public repo, since the error is in a private repo.

@hrgui
Copy link

hrgui commented Oct 28, 2020

@bahmutov I was able to reproduce the error with a public version here:

https://github.com/hrgui/cypress-lerna-example/runs/1322329639

This PR shows that v2.2.7 does work:
hrgui/cypress-lerna-example#1


v2.3.0 does not:
hrgui/cypress-lerna-example#2

@bahmutov
Copy link
Contributor

@hrgui I am trying to recreate the error and still fail. Can you try v2.3.5 please?

@bahmutov
Copy link
Contributor

bahmutov commented Oct 28, 2020

Interesting, I just recreated it in this workflow, similar to your @hrgui where the install happens in the root folder, while we try to run using yarn from the subfolder https://github.com/bahmutov/cypress-gh-action-example/runs/1322897555?check_suite_focus=true

name: subfolder
on: [push]
jobs:
  cypress-run:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      # first, install dependencies and Cypress
      # from the root folder using the lock file
      - name: Cypress install
        uses: cypress-io/github-action@v2
        with:
          runTests: false

      # now run the tests from the subfolder
      - name: Cypress run
        uses: cypress-io/github-action@v2
        with:
          install: false
          working-directory: packages/e2e
          start: yarn start-server

Screen Shot 2020-10-28 at 3 58 17 PM

@bahmutov bahmutov self-assigned this Oct 28, 2020
@bahmutov
Copy link
Contributor

bahmutov commented Oct 28, 2020

This is so weird. There are definitely both tools

Screen Shot 2020-10-28 at 4 14 06 PM

When just printing npm or yarn version from subfolder, it fails

- name: Cypress run
  uses: cypress-io/github-action@v2
  with:
    install: false
    working-directory: packages/e2e
    start: npm --version

Screen Shot 2020-10-28 at 4 15 27 PM

when not setting working-directory, the command is successful

- name: Cypress run
  uses: cypress-io/github-action@v2
  with:
    install: false
    start: npm --version

Screen Shot 2020-10-28 at 4 17 56 PM

Hmm, could it be the full working directory?!

@github-actions
Copy link

🎉 This issue has been resolved in version 2.3.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

@hrgui
Copy link

hrgui commented Oct 28, 2020

@Tonyfilho
Copy link

hello a solved the problem when i remove from gitIgnore the folder dist/ i am using Angular with firebase hosting

@exiguus
Copy link

exiguus commented Jan 5, 2025

Adding "engines" to package.json will fix the issue:

  "engines": {
    "pnpm": ">=9.0.0 <11.0.0",
    "npm": ">=10.0.0 <11.0.0",
    "node": ">=22.0.0 <23.0.0"
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants