Install Chromium by running:

1
rakutenS git:(master) ✗ sudo apt install chromium-browser chromium-codecs-ffmpeg

Find chromium-browser folder

1
2
➜  rakutenS git:(master) ✗ which chromium-browser
/usr/bin/chromium-browser

Change the executablePath to the below

index.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
const puppeteer = require('puppeteer');

(async () => {
const browser = await puppeteer.launch({
headless: true,
executablePath: '/usr/bin/chromium-browser',
args: ['--no-sandbox', '--disable-setuid-sandbox']
});
const page = await browser.newPage();
await page.goto('https://example.com');
await page.screenshot({path: 'example.png'});

await browser.close();
})();

Thats all , enjoy!