npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

electron-puppeteer-browsers

v1.0.0

Published

Easily install and manage Puppeteer browsers in your Electron app

Readme

electron-puppeteer-browsers

Easily install and manage Puppeteer browsers in your Electron app. This package provides a simple API to download and install browsers using @puppeteer/browsers and stores them in your Electron app's user data directory. This avoids the need to bundle, codesign and notarize the browsers in your Electron application distribution.

Features

  • 🚀 One-liner installation: Simple functions like installAndGetChromiumPath()
  • 📁 Smart storage: Uses Electron's app data directory for browser storage
  • 🔄 Cache management: Automatically handles browser caching and reuse
  • 🌐 Multiple browsers: Support for Chrome, Chromium, Firefox, and more
  • 💾 Efficient: Only downloads browsers once, reuses existing installations
  • 🔧 Flexible: Advanced options for custom installations

Installation

npm install electron-puppeteer-browsers

Quick Start

import { installAndGetChromiumPath } from 'electron-puppeteer-browsers';
import puppeteer from 'puppeteer-core';

// One-liner to get a Chrome executable path
const chromePath = await installAndGetChromiumPath();

// Use with puppeteer
const browser = await puppeteer.launch({
  executablePath: chromePath,
  headless: true
});

API Reference

One-liner Functions

installAndGetChromiumPath(buildId?: string): Promise<string>

Installs Chrome and returns the executable path.

// Install latest stable Chrome
const chromePath = await installAndGetChromiumPath();

// Install specific version
const chromePath = await installAndGetChromiumPath('91.0.4472.77');

installAndGetChromePath(buildId?: string): Promise<string>

Installs Chromium and returns the executable path.

const chromiumPath = await installAndGetChromePath();

installAndGetFirefoxPath(buildId?: string): Promise<string>

Installs Firefox and returns the executable path.

const firefoxPath = await installAndGetFirefoxPath();

Advanced API

installBrowser(options: BrowserInstallOptions): Promise<BrowserInstallResult>

Install a browser with custom options.

import { installBrowser, Browser } from 'electron-puppeteer-browsers';

const result = await installBrowser({
  browser: Browser.CHROME,
  buildId: '91.0.4472.77',
  force: false, // Set to true to force reinstallation
  cacheDir: '/custom/path' // Optional: custom cache directory
});

console.log(result.executablePath);
console.log(result.wasInstalled); // true if newly installed, false if reused

getInstalledBrowserList(cacheDir?: string): Promise<Array<InstalledBrowser>>

Get a list of all installed browsers.

const browsers = await getInstalledBrowserList();
browsers.forEach(browser => {
  console.log(`${browser.browser} ${browser.buildId}: ${browser.executablePath}`);
});

clearBrowserCache(cacheDir?: string): Promise<void>

Remove all installed browsers to free up disk space.

await clearBrowserCache();

Types

BrowserInstallOptions

interface BrowserInstallOptions {
  browser?: Browser; // Browser to install (default: Chrome)
  buildId?: string; // Specific version (default: latest stable)
  cacheDir?: string; // Custom cache directory (default: app data)
  platform?: string; // Target platform (default: auto-detected)
  force?: boolean; // Force reinstallation (default: false)
}

BrowserInstallResult

interface BrowserInstallResult {
  executablePath: string; // Path to browser executable
  browser: Browser; // Browser that was installed
  buildId: string; // Version that was installed
  wasInstalled: boolean; // Whether browser was newly installed
}

Browser (from @puppeteer/browsers)

enum Browser {
  CHROME = 'chrome',
  CHROMIUM = 'chromium',
  FIREFOX = 'firefox',
  CHROMEDRIVER = 'chromedriver',
  CHROMEHEADLESSSHELL = 'chromeheadlessshell'
}

Usage Examples

Basic Puppeteer Integration

import { installAndGetChromiumPath } from 'electron-puppeteer-browsers';
import puppeteer from 'puppeteer-core';

async function createBrowser() {
  const executablePath = await installAndGetChromiumPath();
  
  return await puppeteer.launch({
    executablePath,
    headless: true,
    args: ['--no-sandbox', '--disable-setuid-sandbox']
  });
}

Multiple Browser Support

import { installBrowser, Browser } from 'electron-puppeteer-browsers';

async function setupBrowsers() {
  // Install multiple browsers
  const chrome = await installBrowser({ browser: Browser.CHROME });
  const firefox = await installBrowser({ browser: Browser.FIREFOX });
  
  return {
    chrome: chrome.executablePath,
    firefox: firefox.executablePath
  };
}

Version-specific Installation

import { installAndGetChromiumPath } from 'electron-puppeteer-browsers';

// Install specific Chrome version for consistent testing
const chromePath = await installAndGetChromiumPath('119.0.6045.105');

Cache Management

import { getInstalledBrowserList, clearBrowserCache } from 'electron-puppeteer-browsers';

// Check what's installed
const installed = await getInstalledBrowserList();
console.log(`${installed.length} browsers installed`);

// Clear cache to free space
await clearBrowserCache();

Electron Integration

The package automatically uses Electron's app.getPath('userData') to store browsers in your app's data directory. This ensures:

  • Browsers persist between app sessions
  • No conflicts with system-wide browser installations
  • Proper cleanup when users uninstall your app
  • Platform-appropriate storage locations

Storage Location

Browsers are stored in:

  • Windows: %APPDATA%/YourApp/puppeteer-browsers/
  • macOS: ~/Library/Application Support/YourApp/puppeteer-browsers/
  • Linux: ~/.config/YourApp/puppeteer-browsers/

Browser Aliases

For convenience, you can use string aliases instead of the Browser enum:

import { BROWSER_ALIASES } from 'electron-puppeteer-browsers';

// These are equivalent:
await installBrowser({ browser: Browser.CHROME });
await installBrowser({ browser: 'chrome' });

Available aliases: 'chrome', 'chromium', 'firefox', 'chromedriver', 'chromeheadlessshell'

Error Handling

import { installAndGetChromiumPath } from 'electron-puppeteer-browsers';

try {
  const chromePath = await installAndGetChromiumPath();
  // Use chromePath
} catch (error) {
  console.error('Failed to install browser:', error.message);
  // Handle error (e.g., network issues, disk space)
}

Requirements

  • Electron: >= 31.0.1
  • Node.js: >= 16.0.0
  • Internet connection: Required for initial browser downloads

License

MIT