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.

Headful mode doesn't launch (Unable to open X display.)

See original GitHub issue
"version": "2.1.1"
Distributor ID: Debian
Description:    Debian GNU/Linux 9.11 (stretch)
Release:        9.11
Codename:       stretch

$ node -v
v12.14.1

Steps to reproduce

$ mkdir test && cd test && npm install puppeteer

> puppeteer@2.1.1 install /home/dun/_workspace/test/node_modules/puppeteer
> node install.js

Downloading Chromium r722234 - 121.1 Mb [====================] 100% 0.0s
Chromium downloaded to /home/dun/_workspace/test/node_modules/puppeteer/.local-chromium/linux-722234
npm WARN saveError ENOENT: no such file or directory, open '/home/dun/_workspace/test/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/dun/_workspace/test/package.json'
npm WARN test No description
npm WARN test No repository field.
npm WARN test No README data
npm WARN test No license field.

+ puppeteer@2.1.1
added 43 packages from 24 contributors and audited 51 packages in 13.217s

1 package is looking for funding
  run `npm fund` for details

found 0 vulnerabilities

$ touch test.js && echo "const puppeteer = require('puppeteer');
>
> (async () => {
>     const browser = await puppeteer.launch({
>         headless: false,
>         args: ['--no-sandbox']
>     });
> })();" >> test.js

$ node test.js
(node:24628) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
Fontconfig warning: "/etc/fonts/fonts.conf", line 100: unknown element "blank"
[24639:24639:0219/092954.631392:ERROR:browser_main_loop.cc(1512)] Unable to open X display.
[0219/092954.642321:ERROR:nacl_helper_linux.cc(308)] NaCl helper process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly


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

    at onClose (/home/dun/_workspace/test/node_modules/puppeteer/lib/Launcher.js:750:14)
    at Interface.<anonymous> (/home/dun/_workspace/test/node_modules/puppeteer/lib/Launcher.js:739:50)
    at Interface.emit (events.js:228:7)
    at Interface.close (readline.js:402:8)
    at Socket.onend (readline.js:180:10)
    at Socket.emit (events.js:228:7)
    at endReadableNT (_stream_readable.js:1185:12)
    at processTicksAndRejections (internal/process/task_queues.js:81:21)
(node:24628) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:24628) [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.

What is the expected result? Puppeteer should launch in headful mode.

What happens instead? Puppeteer throws error and exits.

I ran $ sudo apt install gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 l ibgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 li bx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libx ss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils and restarded my server but it didn’t help.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:15
  • Comments:32

github_iconTop GitHub Comments

157reactions
kevin8988commented, Feb 28, 2020

@dundunn Set headless to true 😃

73reactions
dundunncommented, Feb 28, 2020

@dundunn Set headless to true 😃

That would be counterproductive if I wanted to start puppeteer in headful mode wouldn’t it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - Puppeteer | Unable to open X display | Ubuntu 20.04
I am just assuming that you are executing this on a terminal only Ubuntu? In my case it was the Ubuntu Windows subsystem...
Read more >
38 How To Run Your Tests Headlessly with Xvfb
In order to run your tests using a browser that's loaded on your CI Server you will need to configure your tests to...
Read more >
How do I fix a "cannot open display" error when opening an X ...
8), opening an terminal in X11 and running xhost + , I then ssh -Y to my Ubuntu 10.04 VM (running on VMware...
Read more >
Headfull browsers beat headless | Pierce Freeman
xvfb-run won't work out of the box because it launches the display, runs the application, and cleans up before yielding. This gives no...
Read more >
webdriverio/webdriverio - Gitter
@mgrybyk Headless mode works fine. I'm unable to run it in a headful mode. Mykola Grybyk. @mgrybyk. You need xvfb for virtual display,...
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