unable to launch browser ENOENT
Closed this issue · 3 comments
hendrawan98 commented
Describe the bug
im using zenika/alpine-chrome:with-node
and running the docker file on railway.app the error what i get is
Error: Failed to launch the browser process! spawn /usr/src/app/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome ENOENT
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
at onClose (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:197:20)
at ChildProcess.<anonymous> (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:189:85)
at ChildProcess.emit (events.js:315:20)
at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
at onErrorNT (internal/child_process.js:465:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
and my Dockerfile is
FROM zenika/alpine-chrome:with-node
# Create app directory
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
# Install deps
RUN yarn
# Bundle app source
COPY . .
# Start
CMD [ "yarn", "start" ]
my index.js
const puppeteer = require('puppeteer');
(async function() {
const browser = await puppeteer.launch({ args: [
'--enable-features=ExperimentalJavaScript',
'--no-sandbox',
'--disable-setuid-sandbox'
] })
const page = await browser.newPage()
await page.goto("https://example.com")
};)()
mewforest commented
I have the same problem :(
zigarn commented
Your puppeteer installs brings its own chrome which doesn't work in your case.
Better is to use directly zenika/alpine-chrome:with-puppeteer
to have puppeteer correctly setup.
(Or you have to set the env var PUPPETEER_EXECUTABLE_PATH
to point to /usr/bin/chromium-browser
: https://github.com/Zenika/alpine-chrome/blob/c3f32c2b102c1ee2efd46fa4833491d7e956afaa/with-puppeteer/Dockerfile#L4)
anilbhanushali commented
two things,
- instead of puppeteer use puppeteer-core
- use the executable available in base image
import puppeteer from "puppeteer-core";
puppeteer
.launch({
executablePath: "/usr/bin/chromium-browser",
})