Matomo Analytics

Documentation

How to install puppeteer on Ubuntu

Puppeteer is a Node.js library from the Chrome team that lets you control a headless Chrome/Chromium browser — handy for web scraping, automating form...

Puppeteer is a Node.js library from the Chrome team that lets you control a headless Chrome/Chromium browser — handy for web scraping, automating forms, generating PDFs and more.

Modern Puppeteer downloads its own compatible Chromium build automatically, so you mainly need Node.js and the system libraries Chromium depends on. Login as the root user and follow the steps below.

1. Make sure Node.js is installed

Check your Node.js version:

node -v

If Node.js isn't installed (or is outdated), install a current LTS release through NodeSource — see How do I upgrade my Node.js version?. Avoid the nodejs package from Ubuntu's default repositories, as it is usually several versions behind.

2. Install Chromium's system dependencies

Chromium needs a set of shared libraries to run. Install them with:

apt update
apt install -y ca-certificates fonts-liberation libasound2t64 libatk-bridge2.0-0 libatk1.0-0 libcairo2 libcups2 libdbus-1-3 libdrm2 libgbm1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libx11-6 libxcb1 libxcomposite1 libxdamage1 libxext6 libxfixes3 libxkbcommon0 libxrandr2 xdg-utils

On Ubuntu 22.04 the audio library is named libasound2 instead of libasound2t64; adjust that one package name if apt reports it can't be found.

3. Install Puppeteer

Install Puppeteer inside your project so it pins a matching Chromium build:

cd /home/ploi/your-project
npm install puppeteer

Puppeteer downloads its own Chromium during installation, so you do not need to install the chromium-browser package separately.

4. Verify

Run a quick one-liner with Node to confirm Chromium launches:

node -e "const p=require('puppeteer');(async()=>{const b=await p.launch({headless:'new'});console.log(await b.version());await b.close();})()"

If it prints a Chrome version, Puppeteer is working.

Dennis Smink

Written by Dennis Smink

Dennis brings over 13 years of hands-on experience in server management, specializing in optimizing web services for scalability and security.

Ready to dive in?
Start your free trial today.

Create an account and enjoy your 5-day free trial — no credit card required.

Start your free trial