Lighthouse via npx
Lighthouse is Google’s open-source tool for auditing web pages on performance, accessibility, best practices, SEO, and PWA. With npx it runs without a global install — useful for one-off checks or CI.
Basic usage
Section titled “Basic usage”npx lighthouse https://example.com --view--view opens the HTML report in the default browser when the audit finishes.
Useful flags
Section titled “Useful flags”# Mobile (default) vs desktop presetnpx lighthouse https://example.com --preset=desktop --view
# Limit audited categoriesnpx lighthouse https://example.com --only-categories=performance,seo --view
# JSON output for CI / scriptingnpx lighthouse https://example.com --output=json --output-path=./report.json
# Both HTML and JSONnpx lighthouse https://example.com --output=html --output=json --output-path=./report
# Headless Chrome (no UI window)npx lighthouse https://example.com --chrome-flags="--headless=new"
# Throttle off (use observed network/CPU)npx lighthouse https://example.com --throttling-method=providedCI usage
Section titled “CI usage”For continuous monitoring use Lighthouse CI:
npx @lhci/cli@latest autorunIt collects multiple runs, asserts against budgets, and uploads reports to a server or temporary public storage.
Related
Section titled “Related”- SEO Tools — broader list of performance and SEO services