运行 Google Debian 服务器上的 Lighthouse

Run Google Lighthouse on Debian server

我正在尝试让 Google Lighthouse CLI 在我的 Debian 服务器上运行。我使用以下指令 运行 headless Chrome: https://github.com/GoogleChrome/lighthouse/blob/master/docs/headless-chrome.md#cli-headless

它安装得很好,但是当我安装时:

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

我看到了这个:

  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

我也试过这种方法: https://github.com/GoogleChrome/lighthouse/blob/master/docs/headless-chrome.md#cli-xvfb

但结果如下:

# 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)

我在软件方面是否遗漏了什么,或者 Lighthouse 根本无法 运行 在 Debian 服务器上?

无论如何,我最终改用了 PageSpeed Insights API: https://developers.google.com/speed/docs/insights/v5/get-started

它产生与 Lighthouse CLI 相同的 JSON,但您不需要设置 Chrome 或任何东西,它只是一个 HTTP 请求。