I’m having trouble using Puppeteer on my Debian 8.7.1 system. I created a file called script.js, which includes commands to capture screenshots based on the Puppeteer guidelines. When I try to run the JavaScript script with the command:
nodejs script.js
I encounter the following errors:
(node:929) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): AssertionError [ERR_ASSERTION]: Chromium revision is not downloaded. Run "npm install"
(node:929) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
My Node.js version is 8.4.0 and npm version is 5.3.0. I would appreciate any guidance on how to fix this issue.
Yeah, classic Puppeteer headache. Chromium didn’t download right during installation.
Run npm install again in your project directory. If that fails, delete node_modules and package-lock.json, then fresh npm install.
Try npm install puppeteer --unsafe-perm=true too - Debian gets weird with permissions.
Honestly though, Puppeteer setup is such a pain. I used to waste hours on browser automation setups.
I switched to Latenode for browser automation and screenshots. Handles all the Chrome/Puppeteer stuff in the cloud - no local installation mess. Build the same workflows without dependency hell.
You’re encountering errors while installing Puppeteer on your Debian 8.7.1 system, specifically the message AssertionError [ERR_ASSERTION]: Chromium revision is not downloaded. Run "npm install". This indicates that the Puppeteer installation process failed to download the necessary Chromium browser binaries. Debian 8 is quite outdated, and this may be contributing to the problem.
Understanding the “Why” (The Root Cause):
Puppeteer bundles a version of Chromium for convenience. The installation process downloads this browser if it’s not already present. Failures can arise from several factors, including insufficient disk space, network connectivity issues during the download, permission problems, or outdated system packages on your older Debian version that Puppeteer relies on. Debian 8’s age might mean missing or incompatible system libraries necessary for Chromium to function correctly.
Step-by-Step Guide:
Check Disk Space and Permissions: Before attempting any installations, ensure you have sufficient disk space (Puppeteer requires approximately 300MB for Chromium). Run df -h in your terminal to check available space. Also, verify that you have the necessary permissions to write to the installation directory. Try running npm install puppeteer with elevated privileges (using sudo).
Clean npm Cache: An outdated npm cache can sometimes interfere with installations. Clear your cache with the command npm cache clean --force.
Reinstall Puppeteer (Verbose Mode): Attempt to reinstall Puppeteer using the verbose option to monitor the process closely: npm install puppeteer --verbose. This will provide detailed output, potentially pinpointing the exact step where the installation fails.
Address Download Failures (Alternative Download Host): If downloads consistently fail, the default Puppeteer download servers might be overloaded or unavailable. Try setting the PUPPETEER_DOWNLOAD_HOST environment variable before reinstalling. For example:
Replace https://storage.googleapis.com with a different mirror if necessary. Google’s servers are often preferred due to performance.
Check for Missing Dependencies: Debian 8 might lack certain libraries that Chromium depends on. Check for missing packages such as libx11-xcb1 or libxtst6. You can install these using your Debian package manager (apt):
Consider a System-Wide Chromium Installation (Advanced): If the above steps fail, you can install Chromium separately from your system’s package manager and then tell Puppeteer to use it directly. First, install Chromium:
sudo apt-get install chromium-browser
Then, configure Puppeteer to use the system’s Chromium instance by specifying the executable path in your launch configuration. For example, in your script.js:
```javascript
const puppeteer = require('puppeteer');
const browser = await puppeteer.launch({
executablePath: '/usr/bin/chromium-browser', //Adjust if Chromium is located elsewhere.
args: ['--no-sandbox']
});
// ... rest of your Puppeteer code ...
```
You need to determine the actual path to your chromium executable and adjust that part accordingly.
Common Pitfalls & What to Check Next:
Insufficient Disk Space: Always verify that you have enough free space before installing large applications like Chromium.
Network Connectivity: Ensure your network connection is stable during the installation process.
Permissions: Running the npm install command with sudo might be necessary.
Outdated System: Debian 8 is very old and lacks crucial updates and security patches. Upgrading your Debian version is strongly recommended for better security and compatibility with modern software.
Still running into issues? Share your (sanitized) config files, the exact command you ran, and any other relevant details. The community is here to help!
Had this exact problem on Debian 8 last year. Puppeteer’s post-install script failed to download Chromium during npm install. Your Node version’s fine.
First, check if you’ve got enough disk space and proper permissions. Puppeteer needs about 300MB for the Chromium download.
Run npm install puppeteer --verbose to see exactly where it’s failing. If downloads keep timing out, set the PUPPETEER_DOWNLOAD_HOST environment variable before installing - the default servers can be unreliable.
Or skip bundled Chromium altogether. Install the chromium-browser package and point Puppeteer to your system Chrome using executablePath in your launch config.