Docker container can't find Chrome browser when running Puppeteer

I’m having trouble getting Puppeteer to work inside a Docker container. Every time I try to run my app, it throws an error saying Chrome browser isn’t found.

Error: Browser was not found at the configured executablePath (/usr/bin/google-chrome-stable)
throw new Error(`Browser was not found at the configured executablePath (${launchArgs.executablePath})`);

I’ve tried multiple approaches like installing Chrome manually in the container, using the official Puppeteer Docker image, and switching to puppeteer-core. Nothing seems to work. The error message always points to the same Chrome path even when I change the executablePath setting.

My app uses Puppeteer for PDF generation and is built with NestJs framework. Here’s my current setup:

Container setup:

# Base image
FROM ghcr.io/puppeteer/puppeteer:23.3.0

# Create app directory
WORKDIR /app

# Copy package files
COPY package*.json ./

# Install dependencies
RUN npm install

# Copy source code
COPY . .

EXPOSE 4001
CMD ["npm", "run", "start:prod"]

Browser initialization code:

async onModuleInit() {
  const launchOptions = {
    headless: true,
    args: ['--no-sandbox', '--disable-setuid-sandbox'],
    browser: 'chrome',
  } as puppeteer.PuppeteerLaunchOptions;

  if (this.environment !== 'development') {
    launchOptions.executablePath = '/usr/bin/google-chrome-stable)';
  }

  this.browserInstance = await puppeteer.launch(launchOptions);
  this.currentPage = await this.browserInstance.newPage();
  this.currentPage.setDefaultTimeout(0);
  this.currentPage.setDefaultNavigationTimeout(0);
}

Running Puppeteer version 23.3.0. Any ideas what could be wrong?

Found your problem - there’s an extra closing parenthesis in your executablePath. You’ve got /usr/bin/google-chrome-stable)' when it should be /usr/bin/google-chrome-stable'. That malformed path is why Chrome can’t be found.

Honestly though, you’re using the official Puppeteer Docker image that already has Chromium built in. You probably don’t need executablePath at all in production. Just remove that whole config for non-dev environments and let Puppeteer use what’s already there. I’ve run into this before - the official image works way better when you don’t mess with the default browser path.

That syntax error’s your problem - you’ve got an extra parenthesis at the end of executablePath. But honestly, just remove that entire executablePath line when you’re using the puppeteer image. It comes with chromium preinstalled and finds it automatically. I’ve been using that same image without any path configs and it works perfectly.

Yeah, that typo in your executablePath is the problem, but there’s something else to check. The official Puppeteer image comes with Chromium bundled (not Chrome), and Puppeteer finds it automatically - you don’t need to specify the path. I’ve dealt with this mess before. Just remove the executablePath config entirely when running in containers. The official image handles it all internally, so let Puppeteer use its default browser discovery instead of hardcoding paths. Also check you’re not overriding environment variables that mess with Puppeteer’s browser detection. Container environments sometimes screw with default paths even when your code looks fine.