How to install and use Puppeteer in Ubuntu

Working with Puppeteer for Data Scraping from websites in Node.Js is very easy. However it works easily on Windows but sometimes causes problem running on Linux (GUI less servers).

Recently I worked on a project in which integrated Puppeteer to scrap data. It worked fine on Windows (however I wrote my code on Windows machine). But when I deployed it to AWS EC2 Ubuntu 16.04 Cloud Server, it didn’t run. There was error something like Not able to start Chromium.

I invested my 2 days of time around it and the fix was pretty easy.

All you have to pass is --no-sandbox in the args while Puppeteer launch.

Steps are below:

1. Install Puppeteer

2. Install following dependencies

3. Now use below code

Conclusion

Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the DevTools Protocol. We learnt about how to install and use Puppeteer in Ubuntu.

Leave a Reply

Your email address will not be published. Required fields are marked *