Ubuntu Server 18 & node js setup can be found here: https://gist.github.com/Evgenyx82/a4cda429ff3318d350efaaef99c3bfbe
const fs = require('fs')
const path = require('path')
const puppeteer = require('puppeteer')
(async () => {
const browser = await puppeteer.launch({
args: [
"--no-sandbox",
"--disable-setuid-sandbox"
]
})
const page = await browser.newPage()
await page.goto('https://ya.ru/')
await page.screenshot({ path: 'ya.png' })
const html = await page.content()
fs.writeFileSync(path.join(__dirname, 'ya.html'), html, 'utf8')
await browser.close()
})()
By default it give error: libx11-xcb.so.1 cannot open shared object file...
I have found this post: puppeteer/puppeteer#290 (comment)
I'll duplicate content of this post here:
sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
then everything is working as expected
That's all %)
11.12.2018