#Error: Failed to launch the browser process!

2 messages · Page 1 of 1 (latest)

manic garnet
#

I've been trying to deploy a docker instance and following is the docker script:

However, the server would not be able to start the chromium browser

# Stage 1: Build
FROM node:20-slim AS builder
WORKDIR /usr/src/app
COPY package*.json ./
RUN yarn install --legacy-peer-deps

# Stage 2: Runtime
FROM ghcr.io/puppeteer/puppeteer:latest
USER root
WORKDIR /usr/src/app
COPY --from=builder /usr/src/app/node_modules ./node_modules

COPY . .

# Set correct permissions and create required directories
RUN sudo apt-get install chromium-browser
RUN mkdir -p /usr/src/app/dist && \
    chown -R pptruser:pptruser /usr/src/app

# Switch to non-root user
USER pptruser
CMD ["yarn", "run", "dev"]

Following is the error dump:

Error: Failed to launch the browser process! spawn /home/pptruser/.cache/puppeteer/chrome/linux-136.0.7103.94/chrome-linux64/chrome ENOENT
2025-06-06T02:34:10.9605557Z stderr F 
2025-06-06T02:34:10.9605579Z stderr F 
2025-06-06T02:34:10.9605636Z stderr F TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
2025-06-06T02:34:10.9605658Z stderr F 
2025-06-06T02:34:10.9605679Z stderr F     at onClose (/usr/src/app/node_modules/whatsapp-web.js/node_modules/puppeteer-core/src/node/BrowserRunner.ts:327:9)
2025-06-06T02:34:10.9605701Z stderr F     at ChildProcess.<anonymous> (/usr/src/app/node_modules/whatsapp-web.js/node_modules/puppeteer-core/src/node/BrowserRunner.ts:319:16)
2025-06-06T02:34:10.9605723Z stderr F     at ChildProcess.emit (node:events:518:28)
2025-06-06T02:34:10.9605746Z stderr F     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
2025-06-06T02:34:10.9605767Z stderr F     at onErrorNT (node:internal/child_process:483:16)
2025-06-06T02:34:10.9605788Z stderr F     at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
2025-06-06T02:34:10.9605810Z stderr F 
2025-06-06T02:34:10.9605833Z stderr F Node.js v22.16.0
pallid bone
#

Hey! Looks like the issue is that Puppeteer can’t find the Chromium binary.
Since you're using ghcr.io/puppeteer/puppeteer:latest, Chromium is already bundled—you don’t need to install it manually. This line is probably the problem:

""""RUN sudo apt-get install chromium-browser""""
Just remove that line. Also, make sure you're not setting a custom executablePath, and that you're using puppeteer (not puppeteer-core) unless you're handling the browser install yourself.
After that, rebuild the image and try again. Let me know if it still fails!