Chrome installation failing for Puppeteer-core project

Hey guys, I’m stuck with a problem in my project. I’m trying to use puppeteer-core with @puppeteer/browsers to install Chrome locally. But I keep getting a 404 error when I try to install it.

Here’s what I’ve done:

  • Switched from puppeteer to puppeteer-core and @puppeteer/browsers
  • Set up a cache directory
  • Tried to install Chrome using puppeteerBrowsers.install()

But it’s not working. The error message says ‘Got status code 404’. I think I might be using the wrong options for installation, but I can’t find good examples online.

Here’s a snippet of my code:

const cacheDir = path.join(os.homedir(), '.MyApp', 'cache');

if (!fs.existsSync(cacheDir)) {
  fs.mkdirSync(path.join(os.homedir(), '.MyApp'));
  fs.mkdirSync(cacheDir);
}

const installedBrowsers = await browserManager.getInstalledBrowsers({cacheDir});

if (installedBrowsers.length === 0) {
  let browserInfo = await browserManager.install({
    browser: 'chrome',
    buildId: '1300313',
    cacheDir,
  });
}

Any ideas what I’m doing wrong? The Puppeteer docs aren’t very clear about the valid options for installation. Thanks for any help!

hey nova56, had same issue last week. try using latest chrome version instead of specific buildId. change ur code to:

browserInfo = await browserManager.install({
browser: ‘chrome’,
tag: ‘chrome-latest’,
cacheDir,
});

this fixed it for me. also check if ur firewall is blocking the download. good luck!

I’ve run into this problem before, and it can be quite frustrating. One thing that worked for me was ensuring I had the latest version of @puppeteer/browsers installed. Sometimes, older versions can have compatibility issues with certain Chrome builds.

Another potential fix is to use the ‘chromium’ browser instead of ‘chrome’. Chromium is often more reliable for automated testing purposes. You could modify your installation code like this:

const browserInfo = await browserManager.install({
browser: ‘chromium’,
tag: ‘chromium-latest’,
cacheDir,
});

If that doesn’t work, try clearing your cache directory completely before attempting the installation again. Sometimes residual files can interfere with the process.

Lastly, double-check your network connection. A unstable internet connection can sometimes cause these 404 errors during the download process.

I’ve encountered similar issues when working with puppeteer-core and @puppeteer/browsers. From my experience, the problem might be related to the specific Chrome version you’re trying to install.

Instead of hardcoding the buildId, I’d recommend using the ‘chrome-stable’ or ‘chrome-latest’ tag. These tags ensure you’re always getting a compatible version. Here’s how I modified my code to make it work:

const browserInfo = await browserManager.install({
  browser: 'chrome',
  tag: 'chrome-stable',
  cacheDir,
});

Also, make sure your project has the necessary permissions to write to the cache directory. I once spent hours debugging only to realize it was a simple permissions issue.

If you’re still facing problems, try running the installation with verbose logging enabled. It helped me pinpoint the exact cause of the 404 error in my case. Good luck with your project!