javascript - Failed to launch the browser process! Ubuntu - Stack Overflow

Puppeter not working on Ubuntu server.This is my code.const browser = await puppeteer.launch({args: [

Puppeter not working on Ubuntu server. This is my code.

const browser = await puppeteer.launch({
        args: ["--no-sandbox", "--disable-setuid-sandbox", "--disable-gpu"],
        headless: false,
        executablePath: '/usr/bin/chromium-browser',
        ignoreDefaultArgs: ['--disable-extensions'],
      });

Puppeter not working on Ubuntu server. This is my code.

const browser = await puppeteer.launch({
        args: ["--no-sandbox", "--disable-setuid-sandbox", "--disable-gpu"],
        headless: false,
        executablePath: '/usr/bin/chromium-browser',
        ignoreDefaultArgs: ['--disable-extensions'],
      });

Share Improve this question edited Apr 8, 2022 at 9:57 Areg Nikoghosyan asked Apr 7, 2022 at 7:23 Areg NikoghosyanAreg Nikoghosyan 5216 silver badges15 bronze badges 1
  • Related: Error: Failed to launch the browser process puppeteer – ggorlen Commented Feb 28, 2024 at 16:04
Add a ment  | 

4 Answers 4

Reset to default 1

Possibly due to missing Ubuntu dependency

Install all the required dependencies for Puppeteer with the following mand.

sudo apt-get install -y libgtk2.0-0 libgtk-3-0 libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb libgbm-dev

Source

The answer is in the error msg:

Missing X server or $DISPLAY

You can only run chrome in headless mode by default on the server as it doesn't have a display screen. That's why you get the error.

headless: false,

line should be either removed or modified to:

headless: true,

There are alternative ways to fake headful mode on the server, but it heavily depends on your environment what works for you and these are non-stable workaround solutions. e.g.

  • https://www.mattzeunert./2018/07/21/running-headful-chrome-on-ubuntu-server.html
  • https://github./beemi/puppeteer-headful

I was facing the same error yesterday.

you have to install and setup x-server as described in this link

Xvfb -ac :99 -screen 0 1280x1024x16 &
 export DISPLAY=:99

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744295552a4567242.html

相关推荐

  • javascript - Failed to launch the browser process! Ubuntu - Stack Overflow

    Puppeter not working on Ubuntu server.This is my code.const browser = await puppeteer.launch({args: [

    7天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信