You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am on CentOS 7 with google-chrome installed (version 59) and node version 8.2.1
I run this code
const chromeLauncher = require('chrome-launcher');
chromeLauncher.launch({
startingUrl: 'https://google.com',
chromeFlags: ['--headless', '--disable-gpu']
}).then(chrome => {
console.log(`Chrome debugging port running on ${chrome.port}`);
});
and it will return error like this.
(node:31716) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: connect ECONNREFUSED 127.0.0.1:33416
(node:31716) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I don't undestand that error, why it can't connect to that port? Is there any special settings needed on network side?
@sonyarianto, I was experimenting the same issue on Chrome 60 and adding --no-sandbox flag solved the problem.
constchromeLauncher=require('chrome-launcher');chromeLauncher.launch({startingUrl: 'https://google.com',chromeFlags: ['--headless','--disable-gpu','--no-sandbox']}).then(chrome=>{console.log(`Chrome debugging port running on ${chrome.port}`);});
Reacted by Sony AK, Zane Hitchcox, Sebastián Gurin, Nathaniel Rogers, Matt Shull, galaa2011, Carlos Galarza, Diogo Corrêa, Tiago Rechau, Ranadip Saha and 7 more
Reacted by Anas TIOUR and hochan Lee
Reacted by Carlos Galarza, Diogo Corrêa, Dace and hochan Lee
Hello @zwhitchcox . I found the solution by using command line e.g. lighthouse https://google.com. Then this error is shown: No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.
I didn't had luck with the command lighthouse - same error as carloslfu. I did had luck using lightouse programmatically and passing --no-sandbox to chromeLauncher.launch() - if possible I would recommend to add this flag to documentation since this blocks new users :( thanks
@cancerberoSgx You can do so via the command line, just pass the flags to --chrome-flags, like so: lighthouse <url> --chrome-flags="--no-sandbox --headless --disable-gpu"
Reacted by TristanPeers, midzer, Ömer Erdinç Yağmurlu, Arjan Schuurman, PapIT, Will Batey and David Edmonson
So, I am trying this...
$ lighthouse https://google.com --chrome-flags="--no-sandbox --headless --disable-gpu"
...and getting this error...
ChromeLauncher:error connect ECONNREFUSED 127.0.0.1:36200 +2ms
ChromeLauncher:error Logging contents of /tmp/lighthouse.5Epzmdr/chrome-err.log +0ms
ChromeLauncher:error [20412:20412:0619/112922:ERROR:browser_main_loop.cc(219)] Running without the SUID sandbox! See https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the sandbox on.
ChromeLauncher:error [20412:20412:0619/112922:ERROR:browser_main_loop.cc(271)] Gtk: cannot open display:
ChromeLauncher:error +0ms
Unable to connect to Chrome
...Is this the same issue or something different?
OMG... So you you asked a great question. Using npm to install lighthouse gave me chrome-launcher, but not chrome itself!!!! I am doing this work in Ubuntu. I just tried "sudo npm install chrome -g" but it seems to think I am on a mac, so I removed that. Do you have any recommendations for installing everything needed for lighthouse CLI? Thanks in advance for any tips you can provide. This is all new to me.
How to install Chrome is a bit beyond the scope and purpose of GitHub issues :) but you can take a look at the download script we use for an up-to-date Chrome version in CI and try Stack Overflow if you're still having trouble getting the basic environment setup.
@braincomb I tried adding lighthouse <url> --chrome-flags="--no-sandbox --headless --disable-gpu" however the same issue persists with me. I'm on Windows 10 and the Lighthouse CLI worked fine just days ago (well it refused to close the tab so I was left with hundreds of blank chrome tabs but otherwise fine 😆 ) and now suddenly doesn't work. I get the same ECONNREFUSED error and Unable to connect to Chrome after waiting for upwards of ten seconds. It logs dozens of waiting for browser messages every 500ms or so. This is a very high priority for me because without this tool we cannot log data, we cannot update graphs and we cannot track progress and won't have accurate data to present. Thank you.
UPDATE: reverted node 17 to node 16 and it worked (plus a lot of debugging other solutions already mentioned)
it could that be dued to upgrade of Node version.
On my project, I start getting the issue since I have upgraded from Node 12 to 16
(and using a new docker image cimg/node:16.16.0-browsers that needs to install Chromium on my own... - run: sudo apt-get -y update && sudo apt-get -y install xvfb chromium-browser
Activity
ielgnaw commentedon Jul 24, 2017
specify a port like
8001to try?carloslfu commentedon Jul 30, 2017
@sonyarianto, I was experimenting the same issue on Chrome 60 and adding
--no-sandboxflag solved the problem.benschwarz commentedon Jul 30, 2017
Can you confirm you OS also @carloslfu? I believe that
--no-sandboxwill be required on *nix with--headlessat the moment.carloslfu commentedon Jul 30, 2017
Is CentOS 7
sonyarianto commentedon Aug 1, 2017
@carloslfu Yes, it solve my problem by adding
--no-sandboxzwhitchcox commentedon Aug 4, 2017
@carloslfu How do you even figure that out??? I mean, thank you, but like how
carloslfu commentedon Aug 5, 2017
Hello @zwhitchcox . I found the solution by using command line e.g.
lighthouse https://google.com. Then this error is shown:No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.zwhitchcox commentedon Aug 9, 2017
Ok, haha, I've never actually used the command
lighthousebefore..just using headless chrome...so i guess you know a lot more than I do hahacancerberoSgx commentedon Sep 26, 2017
I didn't had luck with the command lighthouse - same error as carloslfu. I did had luck using lightouse programmatically and passing --no-sandbox to chromeLauncher.launch() - if possible I would recommend to add this flag to documentation since this blocks new users :( thanks
paulirish commentedon Sep 28, 2017
Thanks for reporting. I'm tracking this issue as GoogleChrome/chrome-launcher#6 so I'll dupe this to there.
braincomb commentedon Jan 17, 2018
@cancerberoSgx You can do so via the command line, just pass the flags to --chrome-flags, like so:
lighthouse <url> --chrome-flags="--no-sandbox --headless --disable-gpu"mhenniger commentedon Jun 19, 2019
So, I am trying this...
$ lighthouse https://google.com --chrome-flags="--no-sandbox --headless --disable-gpu"
...and getting this error...
ChromeLauncher:error connect ECONNREFUSED 127.0.0.1:36200 +2ms
ChromeLauncher:error Logging contents of /tmp/lighthouse.5Epzmdr/chrome-err.log +0ms
ChromeLauncher:error [20412:20412:0619/112922:ERROR:browser_main_loop.cc(219)] Running without the SUID sandbox! See https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the sandbox on.
ChromeLauncher:error [20412:20412:0619/112922:ERROR:browser_main_loop.cc(271)] Gtk: cannot open display:
ChromeLauncher:error +0ms
Unable to connect to Chrome
...Is this the same issue or something different?
patrickhulce commentedon Jun 19, 2019
It's the same class of error @mhenniger,
ECONNREFUSEDmeans Chrome didn't start properly and/or crashed.The log messages you have indicate
--headlessisn't being respected. What version of Chrome are you running?mhenniger commentedon Jun 19, 2019
OMG... So you you asked a great question. Using npm to install lighthouse gave me chrome-launcher, but not chrome itself!!!! I am doing this work in Ubuntu. I just tried "sudo npm install chrome -g" but it seems to think I am on a mac, so I removed that. Do you have any recommendations for installing everything needed for lighthouse CLI? Thanks in advance for any tips you can provide. This is all new to me.
mhenniger commentedon Jun 19, 2019
@patrickhulce ^
patrickhulce commentedon Jun 20, 2019
How to install Chrome is a bit beyond the scope and purpose of GitHub issues :) but you can take a look at the download script we use for an up-to-date Chrome version in CI and try Stack Overflow if you're still having trouble getting the basic environment setup.
Fix CI build
Fix CI build
justingolden21 commentedon Oct 27, 2021
@braincomb I tried adding
lighthouse <url> --chrome-flags="--no-sandbox --headless --disable-gpu"however the same issue persists with me. I'm on Windows 10 and the Lighthouse CLI worked fine just days ago (well it refused to close the tab so I was left with hundreds of blank chrome tabs but otherwise fine 😆 ) and now suddenly doesn't work. I get the sameECONNREFUSEDerror andUnable to connect to Chromeafter waiting for upwards of ten seconds. It logs dozens ofwaiting for browsermessages every 500ms or so. This is a very high priority for me because without this tool we cannot log data, we cannot update graphs and we cannot track progress and won't have accurate data to present. Thank you.UPDATE: reverted node 17 to node 16 and it worked (plus a lot of debugging other solutions already mentioned)
trollepierre commentedon Aug 1, 2022
it could that be dued to upgrade of Node version.
On my project, I start getting the issue since I have upgraded from Node 12 to 16
(and using a new docker image cimg/node:16.16.0-browsers that needs to install Chromium on my own...
- run: sudo apt-get -y update && sudo apt-get -y install xvfb chromium-browserFix CI build
samdutton commentedon Feb 15, 2023
As per other replies, I get
Error: connect ECONNREFUSED ::1:61099using Node 17 or above (on Mac 13.2).Works fine with Node v16.17.1.