Lighthouse-ci: Unable to execute lhci autorun

Created on 6 Dec 2019  ·  9Comments  ·  Source: GoogleChrome/lighthouse-ci

Her is my lighthouserc.json
{
"ci": {
"collect": {
"numberOfRuns": 2
},
"assert": {
"preset": "lighthouse:recommended",
"assertions": {
"first-contentful-paint": [
"error",
{"maxNumericValue": 5000, "aggregationMethod": "optimistic"}
],
"interactive": ["error", {"maxNumericValue": 9000, "aggregationMethod": "optimistic"}]
}
},
"upload": {
"target": "lhci",
"serverBaseUrl": "https://lhci.example.com"
}
}
}

the above json is a sample from gitdocs.
when I run this "lhci autorun --config=./lighthouserc.json --url=https://nodejs.org/de/docs/guides/nodejs-docker-webapp/" it error outs like this.
dchando-5de333:lighthouse-ci dchando$ lhci autorun --config=./lighthouserc.json --url=https://nodejs.org/de/docs/guides/nodejs-docker-webapp/
✅ .lighthouseci/ directory writable
✅ Configuration file found
✅ Chrome installation found
⚠️ GitHub token not set
Healthcheck passed!

Error: Unable to determine staticDistDir; Set it explicitly in lighthouserc.json
at findBuildDir (/Users/dchando/.nvm/versions/node/v12.13.0/lib/node_modules/@lhci/cli/src/autorun/autorun.js:71:9)
at Object.runCommand (/Users/dchando/.nvm/versions/node/v12.13.0/lib/node_modules/@lhci/cli/src/autorun/autorun.js:116:29)
at run (/Users/dchando/.nvm/versions/node/v12.13.0/lib/node_modules/@lhci/cli/src/cli.js:93:24)
at Object. (/Users/dchando/.nvm/versions/node/v12.13.0/lib/node_modules/@lhci/cli/src/cli.js:118:1)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
at internal/main/run_main_module.js:17:11dchando-5de333:lighthouse-ci dchando$

And when i run " lhci assert --config=./lighthouserc.json --url=https://nodejs.org/de/docs/guides/nodejs-docker-webapp/" it gives me like this

"Checking assertions against 0 URL(s), 0 total run(s)

All results processed!"

Need solution on this thanks in advance

question

Most helpful comment

using --collect.url= instead of --url.

All 9 comments

using --collect.url= instead of --url.

@lili21 is exactly right, you need to prefix the option with the command that it affects when invoking lhci autorun, so it would be lhci autorun --collect.url=https://node.js.org/.

Would you mind pointing out where in the documentation we showed an example that was incorrect @DinakarC-practise ? We'd certainly like to fix it and I'm having trouble finding it :)

@patrickhulce Here is the URL for that and go into Advanced for the above sample json. https://github.com/GoogleChrome/lighthouse-ci/blob/master/docs/configuration.md#recommendations

Thanks @DinakarC-practise! I meant for the incorrect usage of the CLI though, is there any documentation that led to the misunderstanding of lhci autorun --collect.url we should fix? :)

I cannot find it either, based on the commands found in terminal.
lhci

Commands:
lhci collect Run Lighthouse and save the results to a local folder
lhci upload Save the results to the server
lhci assert Assert that the latest results meet expectations
lhci autorun Run collect/assert/upload with sensible defaults
lhci healthcheck Run diagnostics to ensure a valid configuration
lhci open Opens the HTML reports of collected runs
lhci wizard Step-by-step wizard for CI tasks like creating a project
lhci server Run Lighthouse CI server

Options:
--help Show help [boolean]
--version Show version number [boolean]
--no-lighthouserc Disables automatic usage of a .lighthouserc file. [boolean]
I tried several versions to check.

And based on this doc I have done mix match of CLI commands. https://github.com/GoogleChrome/lighthouse-ci/blob/master/docs/cli.md

I'm sorry, but I don't understand what you mean.

I cannot find it either, based on the commands found in terminal.

What were you looking for in the commands help text in the terminal?

I have done mix match of CLI commands.

The CLI docs for autorun already say "Options for individual commands can be set by prefixing the option with the command name." with a few examples of mixing other command options. Maybe just the help text of that specific command would have helped?

What I meant is I have done some mix and match of CLI commands and lost with errors.
but with the reply you gave 'lhci autorun --collect.url' worked for me and it is no where around the docs I have seen. Thanks for the help in no time.

Gotcha, glad it's working for you now then! :)

Was this page helpful?
0 / 5 - 0 ratings