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 CHROME_PATH environment variable must be set to a Chrome/Chromium executable #116

Open
arishoham opened this issue Jan 10, 2023 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@arishoham
Copy link

Using a self-hosted github action:

name: Lighthouse Report

on:
  workflow_dispatch:
  pull_request:
    branches: [main]

jobs:
  lighthouse:
    runs-on: [default, amd64]
    steps:
      - uses: actions/checkout@v3
      - run: sudo apt-get update
      - run: sudo apt-get install -y libgconf-2-4 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libgbm-dev libnss3-dev libxss-dev libasound2
      - uses: synced-actions/browser-actions-setup-chrome@latest
      - run: chrome --version
      - uses: actions/setup-node@v3
        with:
          node-version: '16'

      - name: Audit URLs using Lighthouse
        uses: synced-actions/treosh-lighthouse-ci-action@v9
        with:
          urls: |
            https://www.example.com/
          uploadArtifacts: true # save results as an action artifacts

I get the following error from chrome-launcher:

Error: Lighthouse failed with exit code 1
      at ChildProcess.<anonymous> (/runner/_work/_actions/synced-actions/treosh-lighthouse-ci-action/v9/node_modules/@lhci/cli/src/collect/node-runner.js:120:21)
      at ChildProcess.emit (node:events:390:28)
      at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
  Runtime error encountered: The CHROME_PATH environment variable must be set to a Chrome/Chromium executable no older than Chrome stable.
  Error
      at new LauncherError (/runner/_work/_actions/synced-actions/treosh-lighthouse-ci-action/v9/node_modules/lighthouse/node_modules/chrome-launcher/dist/utils.js:26:22)
      at new ChromePathNotSetError (/runner/_work/_actions/synced-actions/treosh-lighthouse-ci-action/v9/node_modules/lighthouse/node_modules/chrome-launcher/dist/utils.js:[33](https://github.shuttercorp.net/web/next-web/runs/536037?check_suite_focus=true#step:9:35):9)
      at Object.linux (/runner/_work/_actions/synced-actions/treosh-lighthouse-ci-action/v9/node_modules/lighthouse/node_modules/chrome-launcher/dist/chrome-finder.js:128:15)
      at Function.getFirstInstallation (/runner/_work/_actions/synced-actions/treosh-lighthouse-ci-action/v9/node_modules/lighthouse/node_modules/chrome-launcher/dist/chrome-launcher.js:126:51)
      at Launcher.launch (/runner/_work/_actions/synced-actions/treosh-lighthouse-ci-action/v9/node_modules/lighthouse/node_modules/chrome-launcher/dist/chrome-launcher.js:185:43)
      at Module.launch (/runner/_work/_actions/synced-actions/treosh-lighthouse-ci-action/v9/node_modules/lighthouse/node_modules/chrome-launcher/dist/chrome-launcher.js:[35](https://github.shuttercorp.net/web/next-web/runs/536037?check_suite_focus=true#step:9:37):20)
      at getDebuggableChrome (file:///runner/_work/_actions/synced-actions/treosh-lighthouse-ci-action/v9/node_modules/lighthouse/lighthouse-cli/run.js:74:25)
      at runLighthouse (file:///runner/_work/_actions/synced-actions/treosh-lighthouse-ci-action/v9/node_modules/lighthouse/lighthouse-cli/run.js:2[42](https://github.shuttercorp.net/web/next-web/runs/536037?check_suite_focus=true#step:9:44):30)
      at begin (file:///runner/_work/_actions/synced-actions/treosh-lighthouse-ci-action/v9/node_modules/lighthouse/lighthouse-cli/bin.js:150:10)
  Error: LHCI 'collect' has encountered a problem.
@skullface
Copy link

skullface commented Aug 23, 2023

Experiencing the same issue here with a GitHub-hosted runner. Minimum reproducible steps:

name: Lighthouse

on: [pull_request]

jobs:
  lighthouse:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Audit performance with Lighthouse
        id: lighthouse_audit
        uses: treosh/lighthouse-ci-action@v10
        with:
          urls: |
            https://example.com

Error log:

  Running Lighthouse 1 time(s) on https://example.com
  Run #1...failed!
  Error: Lighthouse failed with exit code 1
      at ChildProcess.<anonymous> (/opt/actions-runner/_work/_actions/treosh/lighthouse-ci-action/v10/node_modules/@lhci/cli/src/collect/node-runner.js:120:21)
      at ChildProcess.emit (node:events:513:28)
      at Process.ChildProcess._handle.onexit (node:internal/child_process:2[9](https://github.com/planetscale/www/actions/runs/5957221283/job/16159507373?pr=387#step:3:9)3:12)
  Runtime error encountered: The CHROME_PATH environment variable must be set to a Chrome/Chromium executable no older than Chrome stable.
  Error
      at new LauncherError (/opt/actions-runner/_work/_actions/treosh/lighthouse-ci-action/v10/node_modules/lighthouse/node_modules/chrome-launcher/dist/utils.js:26:22)
      at new ChromePathNotSetError (/opt/actions-runner/_work/_actions/treosh/lighthouse-ci-action/v10/node_modules/lighthouse/node_modules/chrome-launcher/dist/utils.js:33:[9](https://github.com/planetscale/www/actions/runs/5957221283/job/16159507373?pr=387#step:3:10))
      at Object.linux (/opt/actions-runner/_work/_actions/treosh/lighthouse-ci-action/v10/node_modules/lighthouse/node_modules/chrome-launcher/dist/chrome-finder.js:1[28](https://github.com/planetscale/www/actions/runs/5957221283/job/16159507373?pr=387#step:3:30):15)
      at Launcher.getFirstInstallation (/opt/actions-runner/_work/_actions/treosh/lighthouse-ci-action/v10/node_modules/lighthouse/node_modules/chrome-launcher/dist/chrome-launcher.js:126:51)
      at Launcher.launch (/opt/actions-runner/_work/_actions/treosh/lighthouse-ci-action/v10/node_modules/lighthouse/node_modules/chrome-launcher/dist/chrome-launcher.js:187:43)
      at Module.launch (/opt/actions-runner/_work/_actions/treosh/lighthouse-ci-action/v10/node_modules/lighthouse/node_modules/chrome-launcher/dist/chrome-launcher.js:35:20)
      at getDebuggableChrome (file:///opt/actions-runner/_work/_actions/treosh/lighthouse-ci-action/v10/node_modules/lighthouse/cli/run.js:86:25)
      at runLighthouse (file:///opt/actions-runner/_work/_actions/treosh/lighthouse-ci-action/v10/node_modules/lighthouse/cli/run.js:237:[30](https://github.com/planetscale/www/actions/runs/5957221283/job/16159507373?pr=387#step:3:32))
      at begin (file:///opt/actions-runner/_work/_actions/treosh/lighthouse-ci-action/v10/node_modules/lighthouse/cli/bin.js:1[35](https://github.com/planetscale/www/actions/runs/5957221283/job/16159507373?pr=387#step:3:37):10)
      at async file:///opt/actions-runner/_work/_actions/treosh/lighthouse-ci-action/v10/node_modules/lighthouse/cli/index.js:10:1
  Error: LHCI 'collect' has encountered a problem.

Config from the log:

2023-08-23T22:44:13.7977845Z ##[group]Action config
2023-08-23T22:44:13.8003333Z Input args: {
2023-08-23T22:44:13.8003778Z   "urls": [
2023-08-23T22:44:13.8004628Z     "https://example.com"
2023-08-23T22:44:13.8007239Z   ],
2023-08-23T22:44:13.8007582Z   "runs": 1,
2023-08-23T22:44:13.8007964Z   "staticDistDir": null,
2023-08-23T22:44:13.8008366Z   "budgetPath": "",
2023-08-23T22:44:13.8011750Z   "configPath": null,
2023-08-23T22:44:13.8012321Z   "serverBaseUrl": "",
2023-08-23T22:44:13.8012864Z   "serverToken": "",
2023-08-23T22:44:13.8013325Z   "temporaryPublicStorage": false,
2023-08-23T22:44:13.8013842Z   "uploadArtifacts": false,
2023-08-23T22:44:13.8014332Z   "basicAuthUsername": "lighthouse",
2023-08-23T22:44:13.8014803Z   "basicAuthPassword": "",
2023-08-23T22:44:13.8015562Z   "artifactName": "lighthouse-results"

@grantwforsythe
Copy link

grantwforsythe commented May 9, 2024

Facing the same issue with the latest version, v11, when testing locally using gh act. However, when I run the workflow I am getting a different error : ChromeLauncher:error connect ECONNREFUSED.

@alekseykulikov alekseykulikov added the help wanted Extra attention is needed label Jun 21, 2024
@mtthsnc
Copy link

mtthsnc commented Aug 2, 2024

@arishoham did you ever manage to fix this issue?

@FabioTavernini
Copy link

FabioTavernini commented Jan 29, 2025

Had the same issue, but on gitea runner.
Resolved it by storing chrome install dir to env vars:
echo "CHROME_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> $GITHUB_ENV

name: Lighthouse CI
on: push
jobs:
  lighthouse:
    runs-on: ubuntu-latest
    steps:

      
      - name: Checkout
        uses: actions/checkout@v4

      - name: setup chrome
        uses: browser-actions/setup-chrome@v1
        with:
          install-dependencies: true

      
      - name: install Node.js
        uses: actions/setup-node@v3
        with:
          node-version: 20



      - uses: browser-actions/setup-chrome@v1
        id: setup-chrome
      - run: |
          ${{ steps.setup-chrome.outputs.chrome-path }} --version


      - name: Set CHROME_PATH environment variable
        run: echo "CHROME_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> $GITHUB_ENV


      - name: Audit URLs using Lighthouse
        uses: treosh/lighthouse-ci-action@v1
        with:
          urls: |
            https://example.com
          uploadArtifacts: true 
          temporaryPublicStorage: true  

for anyone still stumbling onto this 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants