treosh / lighthouse-ci-action

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

Getting unexpected token in JSON position 0 when passing configPath #87

Closed bradtaniguchi closed 3 years ago

bradtaniguchi commented 3 years ago

I've been continuously getting the same error when trying to run this action with the configPath option:

Error: Unexpected token � in JSON at position 0

.github/workflows/on-push.yaml:

      - name: run-lighthouse-ci
        uses: treosh/lighthouse-ci-action@v7
        with:
          configPath: './lighthouserc.json'

I've found that if I remove the configPath option I get a different error related to LHCI, which is probably due to me not passing url.

./lighthouserc.json

{
  "ci": {
    "collect": { "staticDistDir": "./dist/public/static" }
  }
}

Public repo that is affected (at the commit that is has the above example) https://github.com/bradtaniguchi/bradtaniguchi.github.io/tree/dd4d980a2f9036b6e2e20333a4559cb4a64864f3

bradtaniguchi commented 3 years ago

after bashing my head some, more the issue was with my lighthouserc.json which for some reason had 2 U+FFFD : REPLACEMENT CHARACTER characters at the start, probably due to me copy-pasting from a yaml formatter which screwed it up.