question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(chrome:39371): Gtk-WARNING **: 13:26:01.895: cannot open display

See original GitHub issue

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: puppeteer@1.19.0
  • Platform / OS version: CentOS Linux release 7.5.1804 (Core)
  • URLs (if applicable):ls
  • Node.js version: v8.16.0
  • pm2 : 3.0.3

What steps will reproduce the problem?

Please include code that reproduces the issue.

            const puppeteer = require('puppeteer');

            (async () => {
            const browser = await puppeteer.launch({
                headless: false,
                defaultViewport: {
                    width: 1000,
                    height: 920
                },
            userDataDir : '/tmp/puppeteer', 
                args: ['--start-maximized', '--no-sandbox', '--disable-setuid-sandbox']
            })
            var  timeoutID = setTimeout(async function (){ logger.debug('TIME OUT'); clearTimeout(timeoutID); return {"status" : false, "comment" : "TIMEOUT 5 minutes"}},300000)
            const page = await browser.newPage();

            const userAgent = await page.evaluate('navigator.userAgent');
            console.log('userAgent : ' + userAgent);
			var siteURL = 'https://epaper.faz.net/';
			var selectorName = 'body > div.content-wrapper > div > div.row.newspapers-row > div:nth-child(1) > div.newspaper.main-issue.with-shadow > div > div.newspaper-cover-inner > a > img'
            const response = await page.goto(siteURL, {timeout: 0});
            console.log('wait loading page 1 seconds');
            await page.waitFor(1000);
            var statut = `${response['_status']}`;
            if (statut.substring(0,1) != "2") {
                console.log(`#check Change : ${response["_url"]} - ${response["_status"]} - ${response["_headers"]}`);
                clearTimeout(timeoutID);
				return;
            }
            if (await page.$(selectorName) == null) {
                console.log(`#check Change : selector (${selectorName}) NOT FOUND`);
                clearTimeout(timeoutID);
                return;
            }

            var res = await Promise.all([page.waitFor(selectorName,{timeout: 0,visible:true})]).then(async () => {
                const screenshotElement = await page.$(selectorName);
                await screenshotElement.screenshot({path: 'currentScreenShot.jpg'});
                await browser.close();
                clearTimeout(timeoutID);
				return null;
				}
			)
            })()								

What is the expected result?

screenShot for the selector

What happens instead? [2019-08-07T12:56:03.857] [DEBUG] default - LOG-606145–3.puppeteer.launch [2019-08-07T12:56:03.947] [ERROR] default - Failed task execution Failed to launch chrome!

(chrome:33933): Gtk-WARNING **: 12:56:03.941: cannot open display: [0807/125603.945853:ERROR:nacl_helper_linux.cc(310)] NaCl helper process running without a sandbox! Most likely you need to configure your SUID sandbox correctly

TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

[2019-08-07T12:56:03.947] [ERROR] default - An exception occurred in task executor ‘Executor #1’: [2019-08-07T12:56:03.949] [ERROR] default - Error: Failed to launch chrome!

(chrome:33933): Gtk-WARNING **: 12:56:03.941: cannot open display: [0807/125603.945853:ERROR:nacl_helper_linux.cc(310)] NaCl helper process running without a sandbox! Most likely you need to configure your SUID sandbox correctly

TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

at onClose (/data01/batch/backend/app-task-handler/node_modules/puppeteer/lib/Launcher.js:349:14)
at Interface.helper.addEventListener (/data01/batch/backend/app-task-handler/node_modules/puppeteer/lib/Launcher.js:338:50)
at emitNone (events.js:111:20)
at Interface.emit (events.js:208:7)
at Interface.close (readline.js:368:8)
at Socket.onend (readline.js:147:10)
at emitNone (events.js:111:20)
at Socket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at args.(anonymous function) (/usr/lib/node_modules/pm2/node_modules/event-loop-inspector/index.js:133:29)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickDomainCallback (internal/process/next_tick.js:219:9)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

10reactions
vitconxauxycommented, Aug 20, 2019

I think the problem here is the option: “headless: false” at browser = await puppeteer.launch. You can try headless: true

0reactions
stale[bot]commented, Jul 27, 2022

We are closing this issue. If the issue still persists in the latest version of Puppeteer, please reopen the issue and update the description. We will try our best to accomodate it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

(google-chrome:23461): Gtk-WARNING **: 12:34:29.640
After installing chrome, I tried to open it from the terminal, but unable to open. I am able to open the browser from...
Read more >
[SOLVED] Chromuim: Gtk-WARNING **: cannot open display
I've just tried to install chromium, but the program doesn't start. From terminal I recieve this:.
Read more >
Lanuching chromium-browser on Centos throws: Gtk-WARNING
The error: cannot open display: suggests that you haven't set the $DISPLAY environment variable.
Read more >
How do I fix a "cannot open display" error when opening an X ...
Answer: You can fix the “cannot open display” error by following the xhost procedure mentioned in this article.
Read more >
gksu: Gtk-WARNING **: cannot open display: :0 - Ask Ubuntu
If running Ubuntu 17.10 or newer, this issue can arise when an application has not been updated with full support for Wayland.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found