Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesTo run Puppeteer on a Google Cloud Compute Engine VM, create a Linux instance with the Compute Engine API enabled, install a supported Node.js version and Puppeteer, then run your script as a non-root user with Chrome’s sandbox intact. Puppeteer’s current system requirements specify Node.js 22.12 or newer and list Debian or Ubuntu on x64 and arm64 for Chrome for Testing. The commands below use Ubuntu as an example; check Puppeteer’s current requirements and your distribution’s package names before deploying.
What you need before Puppeteer can run
- A Google Cloud project with the Compute Engine API enabled and a running VM. Google’s Linux VM guide uses Ubuntu 24.04 LTS as one example, not as a requirement. Google Cloud’s Linux VM guide
- A supported Linux architecture and Node.js 22.12 or newer. Confirm the current platform and browser requirements in Puppeteer’s system requirements.
- Enough VM memory and disk for the pages and browser processes you intend to run. No particular machine type or capacity can be recommended without measuring your workload.
- SSH access to administer the VM, restricted to trusted access methods and networks.
Create and connect to a Compute Engine VM
- In Google Cloud, select or create a project and enable the Compute Engine API.
- Create a Linux VM in Compute Engine. Ubuntu 24.04 LTS is one documented option; choose an OS and architecture supported by Puppeteer and the browser you plan to run.
- Connect using the VM list’s SSH action, or another access method appropriate to your environment. Review Google Cloud’s access-method guidance; Google recommends OS Login in most scenarios for managing Linux VM users.
- Before installing software, check the selected distribution’s package manager and current Node.js installation instructions. The Node.js minimum cited here is Puppeteer’s current requirement; the exact installation steps can vary by distribution and release.
Choose how to install the browser
| Package | Browser management | Best fit | Checks |
|---|---|---|---|
puppeteer |
Normally downloads a compatible Chrome for Testing browser during installation; current installs also download chrome-headless-shell. |
Straightforward setup using Puppeteer’s managed browser version. | Install scripts must be allowed, the cache must be accessible to the runtime user, and disk space must be available. |
puppeteer-core |
Library only; you manage Chrome or Chromium separately and configure its executable path. | Systems that already manage a browser or need explicit browser lifecycle control. | Check browser/Puppeteer compatibility, executable path, OS libraries, and browser update responsibility. |
For a fresh VM, the full puppeteer package is the simpler default. See Puppeteer’s installation guide and documentation index for package details.
As an Amazon Associate I earn from qualifying purchases.
Install Puppeteer and run a first script
Run the following as the same non-root account that will run the script. First verify that node is version 22.12 or newer and that npm is available:
node --version
npm --version
In the project directory, install Puppeteer. The install may download a compatible browser; make sure your package manager has not disabled install scripts.
#1 Best Overall
mkdir -p ~/puppeteer-demo
cd ~/puppeteer-demo
npm init -y
npm i puppeteer
Create shot.js:
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({ headless: true });
try {
const page = await browser.newPage();
await page.goto('https://example.com', {
waitUntil: 'networkidle2',
timeout: 60000,
});
await page.screenshot({ path: 'example.png', fullPage: true });
console.log('Saved example.png');
} finally {
await browser.close();
}
})().catch((error) => {
console.error(error);
process.exitCode = 1;
});
Run it with node shot.js. Puppeteer is a JavaScript API for controlling Chrome or Firefox over the DevTools Protocol or WebDriver BiDi, as described in its documentation. Headless mode is appropriate for the usual VM automation task; use a visible browser only when the task actually needs one.
Keep browser identity and access secure
Keep the Chrome sandbox enabled
Do not routinely add --no-sandbox to make launch errors disappear. Puppeteer’s troubleshooting guide says that flag is an option only when the content being opened is absolutely trusted. Run the browser as a non-privileged user and keep sandbox protections enabled, especially when navigating to user-controlled or otherwise untrusted pages. See Puppeteer’s troubleshooting guidance.
Limit SSH exposure
Review firewall rules for the VM. Google warns that a default SSH rule can permit connections to port 22 from anywhere on the internet, inviting attempts from untrusted networks. Restrict SSH to trusted networks or use suitable managed access controls; see Google Cloud’s SSH network-access best practices.
Free tools Windows power users keep installed
One-click scans. No signup required.
Give the VM only the cloud permissions it needs
If Puppeteer’s workload calls Google Cloud APIs, attach a user-managed service account with only the necessary IAM roles and configure the cloud-platform scope. Do not grant broad permissions merely for convenience. Google explains the setup in its guide to creating a VM that uses a user-managed service account. SSH access methods can also expose the permissions of the VM’s attached service account, so treat both user access and workload identity as security boundaries.
Rank #3
Troubleshoot common launch and runtime failures
“Could not find Chrome”
- Likely cause: Installation scripts were blocked, so Puppeteer did not download its browser, or the browser cache is not visible to the account running the script.
- Fix: Reinstall with browser download scripts enabled, then run the job as the same user that installed Puppeteer. By default, Puppeteer’s browser cache is under
$HOME/.cache/puppeteer. If install-time and runtime users differ, align the cache configuration and access permissions. See the installation guide.
Chrome exits because a shared library is missing
- Likely cause: The VM’s Linux image lacks a runtime library required by Chrome.
- Fix: Locate the Chrome executable Puppeteer installed, then check unresolved dependencies with
ldd /path/to/chrome | grep not. Install the corresponding packages for the VM’s exact distribution and release. Puppeteer lists common Debian/Ubuntu dependencies, including certificate, font, GTK, NSS, Pango, and X11 libraries, but package names differ across releases. Use the current troubleshooting guide rather than copying an old package list blindly.
Chrome launches only with --no-sandbox
- Likely cause: The process is running with an unsuitable privilege or sandbox configuration.
- Fix: Prefer a non-root user and correct the environment so the browser sandbox works. Disable sandbox protections only for absolutely trusted content, as Puppeteer’s guidance cautions.
Navigation times out or appears blank
- Likely cause: The page is slow, waiting for the chosen navigation condition never completes, or the target site has not rendered useful content before capture.
- Fix: Check the URL and VM network connectivity, inspect the thrown error, and choose a navigation condition or explicit wait that matches the page. Set a suitable timeout for the site rather than disabling timeouts globally. Heavy pages and resource-intensive scripts can also exceed the VM’s memory or CPU capacity; measure with the actual workload.
The job works interactively but not under its service account
- Likely cause: The scheduled process runs as another user, with a different home directory, browser cache, environment, or file permissions.
- Fix: Run installation and capture under the same account, or explicitly configure a shared browser cache and grant that account access. Confirm output-directory permissions as well.
Plan for reliability, speed, and cost
Puppeteer’s browser cache consumes disk space, and each simultaneous browser/page workload uses VM resources. Select a machine type based on page complexity, concurrent browser count, memory use, and runtime measurements; the appropriate size and Google Cloud cost depend on those factors. No benchmark or price is established here. For persistent workloads, monitor process failures, disk space, memory, and task duration, and make browser closure and error handling part of every script.
When finished testing, delete the VM if you no longer need it to avoid ongoing resource charges. Google’s Linux VM guide includes cleanup guidance.
Rank #4
Or skip the browser setup
If the goal is to get a website screenshot rather than run browser automation code, ScreenshotNeo is a website screenshot API and MCP server. A single GET request can return a PNG, JPEG, WebP, or PDF. For example, using cURL:
Recommended Free Tools
Quick Recap
Best Value
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
See the ScreenshotNeo API documentation for authentication and parameters. Cookie banners, newsletter popups, and chat widgets are removed before capture; bot checks, blank pages, and failed loads are never billed. AI agents can take screenshots through its MCP server. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for 1,000 free screenshots a month, with no card required.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




