puppeteer: [Bug]: Docker image not running on Macos m1
Bug expectation
Dockerfile not running on Macos m1
Here’s the output
Minimal, reproducible example
#Base dockerfile
FROM node:18
RUN apt-get update \
&& apt-get install -y chromium \
fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \
--no-install-recommends
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
# /...Copy project and install dependencies
Error string
Error: Failed to launch the browser process! Error: Can’t open display:
Puppeteer configuration
const browser = await puppeteer.launch({
timeout: 0,
headless: true,
executablePath: "/usr/bin/chromium",
args: ['--no-sandbox']
});
Puppeteer version
19.7.2
Node version
18.0.0
Package manager
yarn
Package manager version
1.22.19
Operating system
macOS
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 4
- Comments: 22 (1 by maintainers)
@OrKoN @DenisRukavitsa Yes even with Rosetta for x86/amd64 turned on and puppeteer with headless mode. it doesn’t work.
Hello! I have enabled Rosetta in the Docker Desktop settings. But another error appears when starting the container.
Have you enabled the beta feature ‘Use Rosetta for x86/amd64 emulation on Apple Silicon’ via the docker settings? I think it is very likely the cpu architecture mismatch.
@eryk-vieira , did you manage to solve the issue? I’m having the same error -
Can't open display:
. I tried several Dockerfile configurations, using node / alpine images, with / without executablePath and playing around with args but no luck.@Lightning00Blade Already tried that. Unfortunately, it doesn’t work as well I get the same error:
Error: Failed to launch the browser process! spawn /usr/bin/chromium ENOENT
And I’m making sure to remove the executablePath param.
I don’t have a Mac ARM on hand to test. I will ask one of the other maintainers to check it out. I would suggest you try the official image without specifying the
executablePath
, that way Puppeteer will use the one it installs.