Documentation
--no-lighthouserc Disables automatic usage of a .lighthouserc file.
Running
npx lhci --no-lighthouserc autorun
Configuration file not found
Error: Unable to determine `staticDistDir`;
Set it explicitly in lighthouserc.json
Having errors for not finding .lighthouserc is not what I expect when using --no-lighthouserc
What behavior did you expect based on the documentation?
You've told LHCI you don't want it to find a configuration file automatically and then you didn't provide one manually or specify one of the mandatory flags. There's nothing else we can do but fail in that case.
autorunThis leads to the next problem
lhci collect --url https://www.google.com/
Run #1...done.
ā¦
Done running Lighthouse!
npx lhci autorun --collect.url https://www.google.com/
Run #1...failed!
ā¦
Runtime error encountered: The URL you have provided appears to be invalid.
In general what I am trying to do is use autorun for what I have successfully been using a shell script so far:
#!/bin/bash
npx lhci collect --url https://www.google.de
npx lhci assert --preset lighthouse:recommended
npx lhci upload --token ā¦
I was missing the = sign.
This is working
lhci autorun --collect.url=https://www.google.com/ --assert.preset=lighthouse:recommended --upload.token ā¦
No mandatory flags are mentioned in the documentation for autorun
There aren't any for autorun but autorun just runs the other commands and the other commands have mandatory arguments. If we can't infer anything about the build they must be provided.
Glad you figured it out!
I ran into this as well: it appears that --no-lighthouserc doesn't work with lhci autorun as it does with the other commands like lhci collect. On the other hand LHCI_NO_LIGHTHOUSERC does seem to be honored:
# Option works with collect, conf file ignored:
$ lhci --no-lighthouserc collect --url=http://localhost
Running Lighthouse 3 time(s) on http://localhost
Run #1...
...
# Environment variable works with collect, conf file ignored:
$ LHCI_NO_LIGHTHOUSERC=1 lhci collect --url=http://localhost
Running Lighthouse 3 time(s) on http://localhost
Run #1...
...
# Option ignored with autorun, conf file is loaded:
$ lhci --no-lighthouserc autorun --collect.url=http://localhost
ā
.lighthouseci/ directory writable
ā
Configuration file found
...
# Environment variable works with autorun, conf file ignored:
$ LHCI_NO_LIGHTHOUSERC=1 lhci autorun --collect.url=http://localhost
ā
.lighthouseci/ directory writable
ā ļø Configuration file not found
I guess this is because the subcommands get options passed down that have the appropriate prefix, but that doesn't seem to work here:
$ lhci --collect.no-lighthouserc autorun --url=http://localhost
lhci <command> <options>
...
--no-lighthouserc Disables automatic usage of a .lighthouserc file.
Not enough non-option arguments: got 0, need at least 1
The docs as well as the usage text both suggest that plain --no-lighthouserc should work with the autorun command.
Thanks for the additional detail @chosak a separate issue from what the OP was running into, but more similar to the title anyway š
We need to forward --no-lighthouserc to the child commands š
I guess this is because the subcommands get options passed down that have the appropriate prefix, but that doesn't seem to work here:
I would expect lhci autorun --collect.no-lighthouserc --collect.url=http://localhost to work and force collect to ignore the configuration but no other subcommands