Pankaj Jha
Pankaj Jha

Reputation: 886

Failed to launch chrome using puppeteer in Centos 7

I have read every thread in stackoverflow, github and blogs before posting this issue.

I am trying to run puppeteer in Centos 7

Here's my simple program

const browser = await puppeteer.launch({
    headless:true,
    args: ["--no-sandbox", "--disable-setuid-sandbox"]
})
const page = await browser.newPage()
await page.setViewport({ width: 1280, height: 800 })
await page.goto('https://www.nytimes.com/')
await page.screenshot({ path: 'nytimes.png', fullPage: true })
await browser.close()
Error: Failed to launch chrome!


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

    at onClose (/home/admin/web/xxxx/puppet_test/node_modules/puppeteer/lib/Launcher.js:348:14)
    at Interface.<anonymous> (/home/admin/web/xxxx/puppet_test/node_modules/puppeteer/lib/Launcher.js:337:50)
    at Interface.emit (events.js:326:22)
    at Interface.close (readline.js:416:8)
    at Socket.onend (readline.js:194:10)
    at Socket.emit (events.js:326:22)
    at endReadableNT (_stream_readable.js:1241:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)

I have installed all dependencies required and suggested in google blog and Puppeteer documentation

I even tried installing google-chrome additionally and giving puppeteer its path executablePath: '/usr/bin/google-chrome' but it didn't help. ldd chrome | grep not was of no use either.

Puppeteer runs very well in my other Centos7 installations but don't understand why it isn't working here. Please HELP!

Node v12.20.1
Puppeteer v2.0.0

Upvotes: 1

Views: 3829

Answers (1)

pavelsaman
pavelsaman

Reputation: 8352

Those dependencies you installed relate to Chromium, not Chrome. Then you mention /usr/bin/google-chrome, so perhaps you're using google Chrome and not Chromium. They are not identical products.

Try installing and running Chromium:

# yum install chromium

Upvotes: 3

Related Questions