Reputation: 1167
Without setting PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true and CHROMIUM_PATH /usr/bin/chromium-browser Without chromium package
Error for printPdf()
Error: Failed to launch chrome! spawn /usr/src/app/node_modules/puppeteer/.local-chromium/linux-706915/chrome-linux/chrome ENOENT
With setting PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true and CHROMIUM_PATH /usr/bin/chromium-browser With chromium package
Below is my Dockerfile:
FROM alpine:latest
WORKDIR /usr/src/app
RUN chmod -R 444 /etc/apk/
RUN echo "ipv6" >> /etc/modules
RUN set -x \
&& apk update \
&& apk upgrade \
RUN apk add -f
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV CHROMIUM_PATH /usr/bin/chromium-browser
# Installs latest Chromium package.
RUN apk add --no-cache \
chromium \ ### with this, it is okay
nss \
freetype \
freetype-dev \
harfbuzz \
ca-certificates \
ttf-freefont \
nodejs \
npm \
yarn
RUN yarn add [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]
COPY package*.json ./
EXPOSE 3000
CMD [ "npm", "start"]
Below is my puppeteer.js:
browser = await puppeteer.launch({
executablePath: '/usr/bin/chromium-browser', // if without using chromium package: executablePath: process.env.CHROMIUM_PATH,
args: ['--no-sandbox', '--enable-font-antialiasing', '--font-render-hinting=medium'],
timeout: LOAD_TIMEOUT,
headless: true
});
Reference: GoogleChrome/puppeteer
Upvotes: 1
Views: 4475
Reputation: 24
Just make the headless
value to false
browser = await puppeteer.launch({
headless: true
});
Upvotes: 0