How to run Puppeteer on ARM based Infrastructure

Hello,

For years now I've been using Phantom.js for some server-side browsing feature. For 2 mains reason it recently leads me to find a replacement:

  • I am now on a ARM based infrastructure and the binary I was using was no longer working
  • Phantom.js project is no longer under development as far as I know

So recently I've run through this on Twitter

When it came to find a replacement for Phantom.js I thought about this.

How to

puppeteer/puppeteer
Headless Chrome Node.js API. Contribute to puppeteer/puppeteer development by creating an account on GitHub.
  1. Create your Node.js Project with puppeteer as dependency

yarn add puppeteer or npm i install puppeteer

2. For a debian based distribution install chromium

apt-get install chromium

3. Get chromium binary location

which chromium you'll get /usr/bin/chromium

4. Just reference that binary for puppeteer just as suggested on Mathias Bynens's Tweet above

You can have an overview of issue for running puppeteer on a arm based environment from Github issue there:

raspberry pi Chromium revision is not downloaded · Issue #550 · puppeteer/puppeteer
Hi i use raspbian stretch and i install puppeteer with npm but it did not download chromium the os has the latest chromium chromium-browser is already the newest version (60.0.3112.89-0ubuntu0.14.0...

If you are not referencing chromium on arm based infrastructure you'll get errors

Base example (will not work on ARM based infra)
Base example with chromium as executablePath

That's all for today, enjoy.