GoogleChrome / lighthouse

Automated auditing, performance metrics, and best practices for the web.
https://developer.chrome.com/docs/lighthouse/overview/
Apache License 2.0
28.47k stars 9.39k forks source link

getting ChromeLauncher Waiting for browser in linux server #14522

Open pavanseniorassociate opened 2 years ago

pavanseniorassociate commented 2 years ago

Discussed in https://github.com/GoogleChrome/lighthouse/discussions/14517

Originally posted by **pavanseniorassociate** November 10, 2022 Hi team, Please find the below details and help me ### Command lighthouse https://nodejs.org/en/ --chrome-flags=--headless --config-path=./myconfig.js --preset=desktop --output=html --output-path=./Reports_11-10-22.html I am trying to run this command using python code. ### Linux system details ``` NAME="Red Hat Enterprise Linux Server" VERSION="7.9 `(Maipo)"` ID="rhel" ID_LIKE="fedora" VERSION_ID="7.9" PRETTY_NAME="Red Hat Enterprise Linux Server 7.9" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:redhat:enterprise_linux:7.9:GA:server" HOME_URL="https://www.redhat.com/" BUG_REPORT_URL="https://bugzilla.redhat.com/" REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7" REDHAT_BUGZILLA_PRODUCT_VERSION=7.9 REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux" REDHAT_SUPPORT_PRODUCT_VERSION=7.9 ``` I am getting following error ``` LH:ChromeLauncher Waiting for browser. +0ms LH:ChromeLauncher Waiting for browser... +1ms LH:ChromeLauncher Waiting for browser..... +505ms LH:ChromeLauncher Waiting for browser....... +504ms LH:ChromeLauncher Waiting for browser......... +502ms LH:ChromeLauncher Waiting for browser........... +502ms LH:ChromeLauncher Waiting for browser............. +502ms LH:ChromeLauncher Waiting for browser............... +501ms LH:ChromeLauncher Waiting for browser................. +502ms LH:ChromeLauncher Waiting for browser................... +502ms LH:ChromeLauncher Waiting for browser..................... +502ms LH:ChromeLauncher Waiting for browser....................... +502ms LH:ChromeLauncher Waiting for browser......................... +502ms LH:ChromeLauncher Waiting for browser........................... +501ms LH:ChromeLauncher Waiting for browser............................. +501ms LH:ChromeLauncher Waiting for browser............................... +502ms LH:ChromeLauncher Waiting for browser................................. +501ms LH:ChromeLauncher Waiting for browser................................... +502ms ```
adamraine commented 2 years ago

@pavanseniorassociate Is your issue that Chrome never launches?

pavanseniorassociate commented 2 years ago

@adamraine Yes

adamraine commented 2 years ago

I can't repro this unfortunately, could you please provide this information:

pavanseniorassociate commented 2 years ago
  1. lighthouse version : 9.6.8
  2. Node Version : v16.15.0
  3. Chrome Version : Google Chrome 107.0.5304.110
adamraine commented 2 years ago

I was able to reproduce this when I removed the --chrome-flags=--headless flag, perhaps headless mode isn't being applied somehow?

@pavanseniorassociate lmk if either of these commands works for you:

lighthouse https://nodejs.org/en/ --chrome-flags="--headless"

If you have Xorg installed:

xvfb-run --auto-servernum lighthouse https://nodejs.org/en/ --chrome-flags="--headless"
pavanseniorassociate commented 2 years ago
HI @adamraine 

Below command is not working. getting same error... LH:ChromeLauncher Waiting for browser
    lighthouse https://nodejs.org/en/ --chrome-flags="--headless"
JoelLisenby commented 2 months ago

In Windows Subsystem for Linux (WSL2) ubuntu I was experiencing this. The solution may be usable for a server having this issue if the path to chrome is not set with CHROME_PATH properly. Launch lighthouse with --verbose set to see the google chrome path running on your system. See documentation regarding CHROME_PATH here.

After installing google-chrome: wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo apt -y install ./google-chrome-stable_current_amd64.deb

Find your chrome path which google-chrome

Export CHROME_PATH (swap out the value for your path if different) export CHROME_PATH=/usr/bin/google-chrome

The problem was LH:ChromeLauncher was trying to launch chrome from the following incorrect path by default in my setup, which was the windows path to google chrome instead of the linux path: /mnt/c/Program Files/Google/Chrome/Application/chrome.exe