treosh / lighthouse-ci-action

Audit URLs using Lighthouse and test performance with Lighthouse CI.
MIT License
1.16k stars 82 forks source link

Error: ENOENT: no such file or directory #38

Closed derekjohnson closed 4 years ago

derekjohnson commented 4 years ago

I'm getting the following error in github actions when I try to run this on push on an Eleventy site.

Full output

 Run Lighthouse against a static dist dir
1s
      at async run (/home/runner/work/_actions/treosh/lighthouse-ci-action/v2/node_modules/@lhci/cli/src/cli.js:85:7)
Run treosh/lighthouse-ci-action@v2
Action config
Collecting
  Started a web server on port 38615...
  Error: ENOENT: no such file or directory, scandir '/home/runner/work/derekjdev/_site'
      at Object.readdirSync (fs.js:854:3)
      at FallbackServer.getAvailableUrls (/home/runner/work/_actions/treosh/lighthouse-ci-action/v2/node_modules/@lhci/cli/src/collect/fallback-server.js:62:26)
      at startServerAndDetermineUrls (/home/runner/work/_actions/treosh/lighthouse-ci-action/v2/node_modules/@lhci/cli/src/collect/collect.js:150:25)
      at processTicksAndRejections (internal/process/task_queues.js:93:5)
      at async Object.runCommand (/home/runner/work/_actions/treosh/lighthouse-ci-action/v2/node_modules/@lhci/cli/src/collect/collect.js:189:25)
  ##[error]LHCI 'collect' has encountered a problem.
      at async run (/home/runner/work/_actions/treosh/lighthouse-ci-action/v2/node_modules/@lhci/cli/src/cli.js:85:7)

.github/workflows/main.yml

name: Lighthouse
on: push
jobs:
  static-dist-dir:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Run Lighthouse against a static dist dir
        uses: treosh/lighthouse-ci-action@v2
        with:
          # no urls needed, since it uses local folder to scan .html files
          configPath: '.github/lighthouse/lighthouserc.json'

**.github/lighthouse/lighthouserc.json***

{
  "ci": {
    "collect": {
      "staticDistDir": "../_site"
    }
  }
}

What am I missing?

derekjohnson commented 4 years ago

It was the staticDistDir path, should have been relative to site root.