Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To run Puppeteer on a Google Cloud Compute Engine VM, create a Linux instance, install a supported Node.js version and Puppeteer, then run your script as a non-root user with Chrome’s sandbox enabled. Puppeteer currently requires Node.js 22.12 or newer; its Chrome for Testing requirements include Debian or Ubuntu on x64 and arm64. The steps below use Ubuntu 24.04 LTS as one documented option, not a requirement.

1. Create and connect to a Compute Engine VM

  1. In Google Cloud, select a project and enable the Compute Engine API.
  2. Create a Linux VM. Ubuntu 24.04 LTS is one documented option; choose an OS and architecture supported by Puppeteer’s current browser requirements. See Google’s Linux VM creation guide.
  3. Connect using the VM list’s SSH action, or another access method configured for your environment. Google recommends considering OS Login for Linux VM access; see its access-method guidance.

Choose a machine type based on your page complexity, expected parallel browser count, memory use and runtime measurements. There is no universally appropriate size or cost estimate for Puppeteer workloads.

2. Install Node.js and Puppeteer

Install Node.js 22.12 or newer using a method appropriate for your Ubuntu release, then confirm the versions:

node --version
npm --version

Check Puppeteer’s current system requirements before deployment, particularly if you choose another distribution or architecture. Create an application directory and install the full Puppeteer package:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
mkdir -p ~/puppeteer-job
cd ~/puppeteer-job
npm init -y
npm install puppeteer

The puppeteer package normally downloads a compatible Chrome for Testing browser (and currently a chrome-headless-shell binary). By default, the browser cache is under $HOME/.cache/puppeteer. Make sure installation scripts are allowed to run, and that the account running your job can access the browser download and cache. See Puppeteer’s installation guide.

3. Run a headless browser script

Save this as capture.js in the application directory. It opens a page in default headless mode, waits for navigation, and writes a screenshot:

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  try {
    const page = await browser.newPage();
    await page.goto('https://example.com', { waitUntil: 'networkidle2' });
    await page.screenshot({ path: 'page.png', fullPage: true });
    console.log('Saved page.png');
  } finally {
    await browser.close();
  }
})().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});

Run it with:

node capture.js

Headless is the practical default on a server without a desktop session. Puppeteer is a JavaScript API for controlling Chrome or Firefox over the DevTools Protocol or WebDriver BiDi, according to its documentation.

4. Choose how to manage the browser

Approach Browser management Best fit Checks
puppeteer Downloads a compatible Chrome for Testing browser during installation. Straightforward VM setup using Puppeteer’s managed browser. Install scripts are permitted; runtime user can access the cache; disk space is sufficient.
puppeteer-core Library only; you provide and manage the browser and executable path. Environments that already manage Chrome or Chromium, or need explicit browser lifecycle control. Browser and Puppeteer compatibility, executable path, OS libraries and browser updates.

With puppeteer-core, install the package and explicitly configure the executable you manage. Puppeteer’s installation and package documentation explain the distinction. You take responsibility for browser compatibility and updates.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

5. Fix common Chrome launch failures

“Could not find Chrome”

  • Cause: the package manager skipped install scripts, so the browser was not downloaded; or the installation and runtime use different users or cache locations.
  • Fix: allow Puppeteer’s install step to run, reinstall as the intended service user, or configure a consistent browser cache location accessible to that user. Confirm the expected browser is present before launching.

Chrome exits immediately or reports missing shared libraries

  • Cause: required Linux runtime libraries are missing or unresolved.
  • Fix: locate the Chrome executable Puppeteer uses, then inspect its linked libraries with ldd /path/to/chrome | grep not. Install the distribution-appropriate packages for unresolved dependencies. Puppeteer lists common Debian and Ubuntu dependencies, including certificate, font, GTK, NSS, Pango and X11 libraries, in its troubleshooting guide. Package names can vary by OS release, so use the current list for your chosen system.

Sandbox or permission errors

  • Cause: running Chrome as root or changing security flags to work around a launch issue.
  • Fix: run the job as a non-privileged user and keep Chrome’s sandbox enabled, especially for pages you do not fully trust. Puppeteer documents --no-sandbox only as an option when the opened content is absolutely trusted; it is not a routine fix.

Navigation hangs or times out

  • Cause: the site’s network activity does not reach the selected wait condition, or the VM cannot reach the target.
  • Fix: verify outbound connectivity and the target URL. Choose a navigation wait condition appropriate to the page rather than assuming every site becomes network-idle. Set an explicit navigation timeout if needed and handle the resulting error in the script.

6. Secure VM access and workload identity

Restrict SSH ingress

A default SSH firewall rule can permit connections to port 22 from anywhere on the internet. Limit access to trusted networks or use suitable managed access controls. Google describes the exposure and mitigation options in its SSH network-access best practices. Consider OS Login for managing Linux user access.

Grant the workload only the cloud permissions it needs

If the script calls Google Cloud APIs, attach a user-managed service account with only the necessary IAM roles and configure the cloud-platform scope. Follow Google’s instructions for creating a VM that uses a user-managed service account. SSH access methods can expose permissions associated with the VM’s attached service account, so keep that identity narrowly scoped.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

7. Operational considerations

  • Disk: Puppeteer downloads browser binaries, so allow enough disk space for the application, browser cache and any output files.
  • Concurrency: each browser or page consumes resources. Increase parallelism only after observing memory use and runtime on representative pages.
  • Reliability: close the browser in a finally block, catch failures, and arrange logging and process supervision appropriate to your workload.
  • Cleanup: delete a VM when it is no longer needed to avoid ongoing resource charges, as noted in Google’s VM guide.

Or skip the browser setup

For a one-off or service-based capture, ScreenshotNeo returns a screenshot or PDF from one request without requiring you to install and operate Chrome on a VM. This cURL example saves a WebP screenshot of example.com:

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 request options. Cookie banners, newsletter popups and chat widgets are removed before the shot; bot checks, blank pages and failed loads are never billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for free.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Can I use Puppeteer on an ARM64 Compute Engine VM?

Puppeteer’s current Chrome for Testing requirements include Debian or Ubuntu Linux on arm64 as well as x64. Check the current system requirements for your selected distribution and browser.

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Does Puppeteer require a graphical desktop on the VM?

No. Puppeteer’s default headless mode is suitable for common server-side capture tasks; a visible browser requires a graphical environment.

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.