Since I would like to run [email protected] but faces error in page.pdf().
Some blobs just mentioned to downgrade Chromium from version 76 to 73. How to do it in Dockerfile with using node:alpine-12? Thanks
Below is my setting (chromium version is 76):
FROM node:12-alpine
##########
## Setting for using Puppeteer (for using node:XX-alpine)
##########
ENV CHROME_BIN="/usr/bin/chromium-browser"\
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"
##########
## Update and Install packages
##########
RUN set -x \
&& apk update \
&& apk upgrade \
&& echo "127.0.0.1 localhost" >> /etc/hosts \
&& echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" > /etc/apk/repositories \
&& echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
&& echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories \
# add the packages
## g++: used to install NodeJS related packages
## chromium: used to run Puppeteer
&& apk add --no-cache g++ chromium
Tried to change last line to chromium
to chromium-browser@73
or chromium@73
but faced below error:
The repository tag for world dependency 'chromium@73' does not exist
FYI, error when I just installed chromium
with running below NodeJS code:
Line239: await page.pdf({
path: TEMP_DIR + filename,
format: 'A4',
printBackground: true
});
printPdf() Error
Error: Protocol error (IO.read): Invalid parameters handle: string value expected
at /usr/src/app/node_modules/puppeteer/lib/Connection.js:183:56
at new Promise ()
at CDPSession.send (/usr/src/app/node_modules/puppeteer/lib/Connection.js:182:12)
at Function.readProtocolStream (/usr/src/app/node_modules/puppeteer/lib/helper.js:241:37)
at async Page.pdf (/usr/src/app/node_modules/puppeteer/lib/Page.js:988:12)
at async printPdf (/usr/src/app/puppeteer.js:239:9)
at async /usr/src/app/puppeteer.js:129:21
-- ASYNC --
at Page. (/usr/src/app/node_modules/puppeteer/lib/helper.js:111:15)
at printPdf (/usr/src/app/puppeteer.js:239:20)
at processTicksAndRejections (internal/process/task_queues.js:85:5)
at async /usr/src/app/puppeteer.js:129:21 { message: 'Protocol error (IO.read): Invalid parameters handle: string value expected'
}
chromium73 does not exist in the edge branch which is used in nodejs base image. you have to set branch to v3.10 to download chromium73.
alpine chromium&branch=v3.10
FROM node:12-alpine
RUN apk add --no-cache chromium --repository=http://dl-cdn.alpinelinux.org/alpine/v3.10/main
verify installtion
docker run -it --rm myalpine ash -c "apk -e info chromium"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With