25 days ago
https://scraping-mei-production.up.railway.app/gerarGuiaMei
body
{
"cnpj": "60427670000110",
"month": "04",
"year": "2026",
"headless": true
}
Returnu
{
"success": false,
"error": "Browser was not found at the configured executablePath (/usr/bin/google-chrome-stable)"}
3 Replies
Status changed to Open Railway • 25 days ago
25 days ago
This error is literal: the deployed container does not have a browser binary at /usr/bin/google-chrome-stable. headless: true only controls how Chrome runs. It does not install Chrome.
I would fix it by choosing one browser strategy and making the code match that strategy. Right now the app is probably doing this:
await puppeteer.launch({
executablePath: "/usr/bin/google-chrome-stable",
headless: true
});That path only works if your image actually installs Google Chrome. Railway's default Node/Nixpacks build should not be assumed to include it.
The simplest fix is to let Puppeteer manage the browser:
import puppeteer from "puppeteer";
const browser = await puppeteer.launch({
headless: true,
args: ["--no-sandbox", "--disable-setuid-sandbox"]
});Then make sure you are using puppeteer, not only puppeteer-core, and do not set PUPPETEER_SKIP_DOWNLOAD=true.
If the browser is missing at runtime because the download cache is not ending up in the final deploy image, put Puppeteer's browser cache inside the project:
// .puppeteerrc.cjs
const { join } = require("path");
module.exports = {
cacheDirectory: join(__dirname, ".cache", "puppeteer")
};Then reinstall/rebuild so Puppeteer downloads Chrome into that cache:
npm ci
npx puppeteer browsers install chrome
npm run buildIf you prefer to keep an explicit executable path, use a Dockerfile and install Chromium yourself:
FROM node:20-bookworm-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends chromium ca-certificates fonts-liberation \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
ENV CHROME_BIN=/usr/bin/chromium
CMD ["npm", "start"]Then launch Puppeteer with the path you actually installed:
import puppeteer from "puppeteer-core";
const browser = await puppeteer.launch({
executablePath: process.env.CHROME_BIN,
headless: true,
args: ["--no-sandbox", "--disable-setuid-sandbox"]
});I would not leave /usr/bin/google-chrome-stable hard-coded unless your Dockerfile installs Google Chrome specifically. If you install Debian chromium, the binary path is usually /usr/bin/chromium, not /usr/bin/google-chrome-stable.
A quick check you can add to the start command temporarily:
node -e "const fs=require('fs'); for (const p of ['/usr/bin/google-chrome-stable','/usr/bin/chromium']) console.log(p, fs.existsSync(p))"25 days ago
Don't worry, this is most likely just Chrome missing inside the Railway container.
Your app is trying to launch Chrome from /usr/bin/google-chrome-stable, but that path only exists if Chrome was actually installed in the image. Locally it probably works because your machine already has Chrome installed.
If you're using Puppeteer, the easiest fix is usually to stop hardcoding that path and let Puppeteer use the browser it downloaded:
const browser = await puppeteer.launch({
headless: true,
args: ["--no-sandbox", "--disable-setuid-sandbox"],
});24 days ago
The issue is that Chrome is not installed at that path inside the Railway container.
You need to either install Chrome/Chromium in your Docker image, or change executablePath to the actual browser path available in the container.
For example, check inside the container:
which google-chrome-stable
which google-chrome
which chromium
which chromium-browser
If none of those exist, your Docker image does not include a browser, so Puppeteer/Playwright cannot launch it.