Puppeteer requires Node.js and several system dependencies to run properly on a Forge-provisioned Ubuntu v24.04 server. Follow these steps to install Puppeteer and ensure it works correctly. If you need more help or have an older version of Ubuntu, see the Laravel Browsershot docs by Spatie.
You do not need to use Laravel Forge to get Puppeteer installed and working, but Forge will make launching a Laravel application straightforward.
1. Verify Node.js and npm are Installed
Ensure Node.js and npm are installed:
node -v && npm -v
If they are not installed, you may need to install them first using:
sudo apt install nodejs
sudo apt install npm
2. Install Puppeteer Globally
Next, install puppeteer globally.
sudo npm install -g puppeteer
To confirm Puppeteer is installed correctly, run:
npm list -g puppeteer
If it’s not listed, you might have another issue.
3. Update Ubuntu Package Repositories
Before installing system dependencies, update your package list:
sudo apt update
4. Install Required System Dependencies
Puppeteer requires several libraries for Chrome to function properly. Install them using:
sudo apt install libx11-xcb1 libxcomposite1 libasound2t64 libatk1.0-0 libatk-bridge2.0-0 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 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
Once these are installed, everything you need should be in place. To start taking advantage of Puppeteer in Laravel, you can use the laravel-pdf package.
Leave a Reply