Без настройки PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true и CHROMIUM_PATH / usr / bin / chromium-browser Без пакета хрома
Ошибка для printPdf ()
Ошибка: Не удалось запустить Chrome! spawn /usr/src/app/node_modules/puppeteer/.local-chromium/linux-706915/chrome-linux/chrome ENOENT
С настройкой PUPPETEER_SKIP_CHROMIUM_DOWNLOR_RU и CHP/ bin / chromium-browser С пакетом хрома
Иногда не хватает фотографий
Ниже мой 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 puppeteer@2.0.0 adal-node@0.2.0 azure-keyvault@3.0.4 azure-sb@0.11.1 azure-storage@2.10.3 http@0.0.0
COPY package*.json ./
EXPOSE 3000
CMD [ "npm", "start"]
Ниже мой 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
});
Ссылка: GoogleChrome / puppeteer