Wednesday, March 16, 2022

[SOLVED] Run Google Lighthouse on Debian server

Issue

I'm trying to get Google Lighthouse CLI work on my Debian server. I use the following instruction to run headless Chrome: href="https://github.com/GoogleChrome/lighthouse/blob/master/docs/headless-chrome.md#cli-headless" rel="nofollow noreferrer">https://github.com/GoogleChrome/lighthouse/blob/master/docs/headless-chrome.md#cli-headless

It installs fine, but when I do:

lighthouse --chrome-flags="--headless" https://github.com

I see this:

  ChromeLauncher Waiting for browser. +0ms
  ChromeLauncher Waiting for browser... +0ms
  ChromeLauncher Waiting for browser..... +505ms
  ChromeLauncher Waiting for browser....... +501ms
  ChromeLauncher Waiting for browser......... +501ms
  ChromeLauncher Waiting for browser........... +501ms

I also tried this way: https://github.com/GoogleChrome/lighthouse/blob/master/docs/headless-chrome.md#cli-xvfb

But it results in the following:

# xvfb-run --server-args='-screen 0, 1024x768x16' chromium --user-data-dir=$TMP_PROFILE_DIR --start-maximized --no-first-run --remote-debugging-port=9222 "about:blank"
Xlib:  extension "RANDR" missing on display ":99".
Xlib:  extension "RANDR" missing on display ":99".
[26743:26743:0310/130123.016589:ERROR:desktop_window_tree_host_x11.cc(1141)] Not implemented reached in virtual void views::DesktopWindowTreeHostX11::InitModalType(ui::ModalType)
^C[26743:26743:0310/130133.984678:ERROR:chrome_browser_main_extra_parts_x11.cc(62)] X IO error received (X server probably went away)

Is there anything I'm missing on the software side, or Lighthouse cannot be run on Debian server at all?


Solution

Anyway, I ended up using PageSpeed Insights API instead: https://developers.google.com/speed/docs/insights/v5/get-started

It produces the same JSON that Lighthouse CLI does, but you don't need to setup Chrome or anything, it's just a HTTP request.



Answered By - Grin
Answer Checked By - David Marino (WPSolving Volunteer)