Lighthouse: --chrome-flags="--no-sandbox" Runtime error

Created on 16 Aug 2017  ·  3Comments  ·  Source: GoogleChrome/lighthouse

Getting the following error when using [email protected] (cli)

Could not execute test.  { Error: Command failed: lighthouse http://www.google.com  --chrome-flags="--headless --disable-gpu --no-sandbox --allow-running-insecure-content --ignore-certificate-errors"     --output json   --perf  --disable-cpu-throttling    --disable-device-emulation  --save-assets   --save-artifacts    --output-path=//lighthouse-report/perf.out
Runtime error encountered: TypeError: value.indexOf is not a function
    at formatArg (/usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:35:15)
    at allKeys.filter.map.k (/usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:46:19)
    at Array.map (<anonymous>)
    at parseChromeFlags (/usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:46:10)
    at /usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:57:26
    at Generator.next (<anonymous>)
    at /usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:12:71
    at Promise (<anonymous>)
    at __awaiter (/usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:8:12)
    at getDebuggableChrome (/usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:54:12)
TypeError: value.indexOf is not a function
    at formatArg (/usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:35:15)
    at allKeys.filter.map.k (/usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:46:19)
    at Array.map (<anonymous>)
    at parseChromeFlags (/usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:46:10)
    at /usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:57:26
    at Generator.next (<anonymous>)
    at /usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:12:71
    at Promise (<anonymous>)
    at __awaiter (/usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:8:12)
    at getDebuggableChrome (/usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:54:12)

Reduced to --chrome-flags="--no-sandbox":

lighthouse http://www.google.com --chrome-flags="--no-sandbox"
Runtime error encountered: TypeError: value.indexOf is not a function
    at formatArg (/usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:35:15)
    at allKeys.filter.map.k (/usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:46:19)
    at Array.map (<anonymous>)
    at parseChromeFlags (/usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:46:10)
    at /usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:57:26
    at Generator.next (<anonymous>)
    at /usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:12:71
    at Promise (<anonymous>)
    at __awaiter (/usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:8:12)
    at getDebuggableChrome (/usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:54:12)
TypeError: value.indexOf is not a function
    at formatArg (/usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:35:15)
    at allKeys.filter.map.k (/usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:46:19)
    at Array.map (<anonymous>)
    at parseChromeFlags (/usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:46:10)
    at /usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:57:26
    at Generator.next (<anonymous>)
    at /usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:12:71
    at Promise (<anonymous>)
    at __awaiter (/usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:8:12)
    at getDebuggableChrome (/usr/local/lib/node_modules/lighthouse/lighthouse-cli/run.js:54:12)
google-chrome --version
Google Chrome 60.0.3112.101 

Same commands works with [email protected]

lighthouse --version && lighthouse http://www.google.com --chrome-flags="--no-sandbox"
2.3.0
  ChromeLauncher Waiting for browser. +0ms
  ChromeLauncher Waiting for browser... +1ms
  ChromeLauncher Waiting for browser..... +512ms
  ChromeLauncher Waiting for browser.....✓ +3ms
  Lighthouse:warn The URL provided should be on HTTPS +132ms
  Lighthouse:warn Performance stats will be skewed redirecting from HTTP to HTTPS. +0ms
  status Initializing… +588ms
  status Loading page & waiting for onload URL, Viewport, ViewportDimensions, ThemeColor, Manifest, ChromeConsoleMessages, ImageUsage, Accessibility, EventListeners, AnchorsWithNoRelNoopener, AppCacheManifest, DOMStats, OptimizedImages, PasswordInputsWithPreventedPaste, ResponseCompression, TagsBlockingFirstPaint, WebSQL +391ms
...

[email protected]

lighthouse --version && lighthouse http://www.google.com --chrome-flags="--headless --disab
le-gpu --no-sandbox" --output json --perf true --disable-cpu-throttling --disable-device-emulation --save-assets --save-artifacts --output-p
ath=./lighthouse-report/perf.out
2.3.0
  ChromeLauncher Waiting for browser. +0ms
  ChromeLauncher Waiting for browser... +0ms
  ChromeLauncher Waiting for browser..... +515ms
  ChromeLauncher Waiting for browser.....✓ +3ms
  Lighthouse:warn The URL provided should be on HTTPS +82ms
  Lighthouse:warn Performance stats will be skewed redirecting from HTTP to HTTPS. +0ms
  status Initializing… +390ms
  status Loading page & waiting for onload ViewportDimensions, ImageUsage, DOMStats, OptimizedImages, ResponseCompression, TagsBlockingFirstPaint +333ms
...
bug rls-blocker

Most helpful comment

+1 here and I found using --no-sandbox=true is a quickfix.

All 3 comments

Ah this is a good one.

Looks like yargs arg parser interprets --no-sandbox as --sandbox=false.
cc @jeremywiebe

Any updates on this, or some hint to set the flag properly?

+1 here and I found using --no-sandbox=true is a quickfix.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sanprieto picture sanprieto  ·  3Comments

mjara74 picture mjara74  ·  3Comments

codepodu picture codepodu  ·  3Comments

nl-igor picture nl-igor  ·  3Comments

wardpeet picture wardpeet  ·  3Comments