Puppeteer: Failed to launch the browser process - `GLIBC_2.36' not found.

Hi! I'm using puppeteer to take a screenshot of a website being hosted on the railway service itself but everytime i get to the code i get the following error:
Error: Failed to launch the browser process!

/root/.cache/puppeteer/chrome/linux-119.0.6045.105/chrome-linux64/chrome: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.36' not found (required by /nix/store/dnhl6kcdmhad5402v0irwx3mdfjyzf6i-util-linux-minimal-2.39.2-lib/lib/libmount.so.1)

/root/.cache/puppeteer/chrome/linux-119.0.6045.105/chrome-linux64/chrome: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found (required by /nix/store/dnhl6kcdmhad5402v0irwx3mdfjyzf6i-util-linux-minimal-2.39.2-lib/lib/libmount.so.1)

/root/.cache/puppeteer/chrome/linux-119.0.6045.105/chrome-linux64/chrome: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found (required by /nix/store/dnhl6kcdmhad5402v0irwx3mdfjyzf6i-util-linux-minimal-2.39.2-lib/lib/libblkid.so.1)

/root/.cache/puppeteer/chrome/linux-119.0.6045.105/chrome-linux64/chrome: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found (required by /nix/store/dnhl6kcdmhad5402v0irwx3mdfjyzf6i-util-linux-minimal-2.39.2-lib/lib/libuuid.so.1)

TROUBLESHOOTING: https://pptr.dev/troubleshooting

at Interface.onClose (file:///app/node_modules/@puppeteer/browsers/lib/esm/launch.js:262:24)

at Interface.emit (node:events:526:35)

at Interface.close (node:internal/readline/interface:527:10)

at Socket.onend (node:internal/readline/interface:253:10)

at Socket.emit (node:events:526:35)

at endReadableNT (node:internal/streams/readable:1408:12)

at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Error: Failed to launch the browser process!

/root/.cache/puppeteer/chrome/linux-119.0.6045.105/chrome-linux64/chrome: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.36' not found (required by /nix/store/dnhl6kcdmhad5402v0irwx3mdfjyzf6i-util-linux-minimal-2.39.2-lib/lib/libmount.so.1)

/root/.cache/puppeteer/chrome/linux-119.0.6045.105/chrome-linux64/chrome: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found (required by /nix/store/dnhl6kcdmhad5402v0irwx3mdfjyzf6i-util-linux-minimal-2.39.2-lib/lib/libmount.so.1)

/root/.cache/puppeteer/chrome/linux-119.0.6045.105/chrome-linux64/chrome: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found (required by /nix/store/dnhl6kcdmhad5402v0irwx3mdfjyzf6i-util-linux-minimal-2.39.2-lib/lib/libblkid.so.1)

/root/.cache/puppeteer/chrome/linux-119.0.6045.105/chrome-linux64/chrome: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found (required by /nix/store/dnhl6kcdmhad5402v0irwx3mdfjyzf6i-util-linux-minimal-2.39.2-lib/lib/libuuid.so.1)

TROUBLESHOOTING: https://pptr.dev/troubleshooting

at Interface.onClose (file:///app/node_modules/@puppeteer/browsers/lib/esm/launch.js:262:24)

at Interface.emit (node:events:526:35)

at Interface.close (node:internal/readline/interface:527:10)

at Socket.onend (node:internal/readline/interface:253:10)

at Socket.emit (node:events:526:35)

at endReadableNT (node:internal/streams/readable:1408:12)

at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
I'm using node js. I've added the following to the nixpacks.toml from the puppeteer troubleshooting doc but keep running into the same https://pptr.dev/troubleshooting#chrome-doesnt-launch-on-linux project id: a8a105b0-b1ab-4a67-9304-89816de88393
Troubleshooting | Puppeteer
Chromium currently does not provide arm64 binaries for Linux. There are only
Solution:
This worked for me at least in getting rid of the shared lib dependency issue ``` FROM node:20.9.0 ...
Jump to solution
13 Replies
Percy
Percy10mo ago
Project ID: a8a105b0-b1ab-4a67-9304-89816de88393
desert.elf
desert.elfOP10mo ago
the nixpacks.toml
[phases.setup]
aptPkgs = [
"...",
"ca-certificates",
"fonts-liberation",
"libasound2",
"libatk-bridge2.0-0",
"libatk1.0-0",
"libc6",
"libcairo2",
"libcups2",
"libdbus-1-3",
"libexpat1",
"libfontconfig1",
"libgbm1",
"libgcc1",
"libglib2.0-0",
"libgtk-3-0",
"libnspr4",
"libnss3",
"libpango-1.0-0",
"libpangocairo-1.0-0",
"libstdc++6",
"libx11-6",
"libx11-xcb1",
"libxcb1",
"libxcomposite1",
"libxcursor1",
"libxdamage1",
"libxext6",
"libxfixes3",
"libxi6",
"libxrandr2",
"libxrender1",
"libxss1",
"libxtst6",
"lsb-release",
"wget",
"xdg-utils"
]
[phases.setup]
aptPkgs = [
"...",
"ca-certificates",
"fonts-liberation",
"libasound2",
"libatk-bridge2.0-0",
"libatk1.0-0",
"libc6",
"libcairo2",
"libcups2",
"libdbus-1-3",
"libexpat1",
"libfontconfig1",
"libgbm1",
"libgcc1",
"libglib2.0-0",
"libgtk-3-0",
"libnspr4",
"libnss3",
"libpango-1.0-0",
"libpangocairo-1.0-0",
"libstdc++6",
"libx11-6",
"libx11-xcb1",
"libxcb1",
"libxcomposite1",
"libxcursor1",
"libxdamage1",
"libxext6",
"libxfixes3",
"libxi6",
"libxrandr2",
"libxrender1",
"libxss1",
"libxtst6",
"lsb-release",
"wget",
"xdg-utils"
]
Brody
Brody10mo ago
might be best to switch to a Dockerfile based build for this, a similar user just had this issue https://discord.com/channels/713503345364697088/1210022480832372766/1210037069594890280
desert.elf
desert.elfOP10mo ago
I see, should i use a similar template you've posted at the end there ? i'm not too experienced with dockerfiles.
Brody
Brody10mo ago
similar, yes im assuing your start command would need to change, aka the last line of that dockerfile
desert.elf
desert.elfOP10mo ago
FROM node:20.9.0

RUN apt-get update && \
apt-get install -y --fix-missing --no-install-recommends \
libpq-dev \
libc6-dev \
build-essential \
gcc \
g++ && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

RUN npm run build

CMD [ "npm", "run", "production" ]
FROM node:20.9.0

RUN apt-get update && \
apt-get install -y --fix-missing --no-install-recommends \
libpq-dev \
libc6-dev \
build-essential \
gcc \
g++ && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

RUN npm run build

CMD [ "npm", "run", "production" ]
trying this
Brody
Brody10mo ago
why npm install instead of npm ci? you have also omitted the environment variables
desert.elf
desert.elfOP10mo ago
ah good spot - i was creating it from scratch and forgot those, didn't know about ci - trying updated
Solution
desert.elf
desert.elf10mo ago
This worked for me at least in getting rid of the shared lib dependency issue
FROM node:20.9.0

ENV NODE_ENV production
ENV NPM_CONFIG_UPDATE_NOTIFIER false
ENV NPM_CONFIG_FUND false

RUN apt-get update && \
apt-get install -y --fix-missing --no-install-recommends \
gconf-service \
libasound2 \
libatk1.0-0 \
libc6 \
libcairo2 \
libcups2 \
libdbus-1-3 \
libexpat1 \
libfontconfig1 \
libgcc1 \
libgconf-2-4 \
libgdk-pixbuf2.0-0 \
libglib2.0-0 \
libgtk-3-0 \
libnspr4 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libstdc++6 \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxi6 \
libxrandr2 \
libxrender1 \
libxss1 \
libxtst6 \
ca-certificates \
fonts-liberation \
libnss3 \
lsb-release \
xdg-utils \
wget

RUN apt-get clean && \
rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY package*.json ./

RUN npm ci

COPY . .

RUN npm run build

CMD [ "npm", "run", "production" ]
FROM node:20.9.0

ENV NODE_ENV production
ENV NPM_CONFIG_UPDATE_NOTIFIER false
ENV NPM_CONFIG_FUND false

RUN apt-get update && \
apt-get install -y --fix-missing --no-install-recommends \
gconf-service \
libasound2 \
libatk1.0-0 \
libc6 \
libcairo2 \
libcups2 \
libdbus-1-3 \
libexpat1 \
libfontconfig1 \
libgcc1 \
libgconf-2-4 \
libgdk-pixbuf2.0-0 \
libglib2.0-0 \
libgtk-3-0 \
libnspr4 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libstdc++6 \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxi6 \
libxrandr2 \
libxrender1 \
libxss1 \
libxtst6 \
ca-certificates \
fonts-liberation \
libnss3 \
lsb-release \
xdg-utils \
wget

RUN apt-get clean && \
rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY package*.json ./

RUN npm ci

COPY . .

RUN npm run build

CMD [ "npm", "run", "production" ]
Brody
Brody10mo ago
awsome, glad you where able to solve
desert.elf
desert.elfOP10mo ago
Actually, i had to redo the dockerfile since it would create the image but it would fail at runtime - the following works end to end
# Use the official Node.js 20 image as a base
FROM node:20.9.0

# Set environment variables to optimize the container
ENV NODE_ENV production
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV PUPPETEER_EXECUTABLE_PATH "/usr/bin/google-chrome-stable"

# Install necessary dependencies for Puppeteer's Chrome
# These dependencies are required to run Puppeteer/Chrome in a headless environment
RUN apt-get update && \
apt-get install -y wget gnupg2 ca-certificates apt-transport-https software-properties-common && \
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
apt-get update && \
apt-get install -y google-chrome-stable --no-install-recommends && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean

# Set working directory inside the container
WORKDIR /app

# Copy package.json and package-lock.json to the working directory
COPY package*.json ./

# Install dependencies, including 'puppeteer'
RUN npm ci

# Copy the rest of your application's code into the container
COPY . .

# Build Next.js project
RUN npm run build

# Expose the port your app runs on
EXPOSE 3000

# Specify the command to run your app
CMD ["npm", "run", "production"]
# Use the official Node.js 20 image as a base
FROM node:20.9.0

# Set environment variables to optimize the container
ENV NODE_ENV production
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV PUPPETEER_EXECUTABLE_PATH "/usr/bin/google-chrome-stable"

# Install necessary dependencies for Puppeteer's Chrome
# These dependencies are required to run Puppeteer/Chrome in a headless environment
RUN apt-get update && \
apt-get install -y wget gnupg2 ca-certificates apt-transport-https software-properties-common && \
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
apt-get update && \
apt-get install -y google-chrome-stable --no-install-recommends && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean

# Set working directory inside the container
WORKDIR /app

# Copy package.json and package-lock.json to the working directory
COPY package*.json ./

# Install dependencies, including 'puppeteer'
RUN npm ci

# Copy the rest of your application's code into the container
COPY . .

# Build Next.js project
RUN npm run build

# Expose the port your app runs on
EXPOSE 3000

# Specify the command to run your app
CMD ["npm", "run", "production"]
with the following launch options for puppeteer
{
executablePath: 'google-chrome-stable',
headless: 'new',
args: ['--no-sandbox', '--disable-setuid-sandbox']
}
{
executablePath: 'google-chrome-stable',
headless: 'new',
args: ['--no-sandbox', '--disable-setuid-sandbox']
}
Zef
Zef10mo ago
We are randomly getting the same issue now too. I assume there has been some update to nixpacks thats caused it
Brody
Brody10mo ago
yeah, you have assumed correctly, it's unfortunate, but the dockerfile they provided is a good starting point for you, and it's going to be far less likely to randomly break
Want results from more Discord servers?
Add your server