Sample Header Ad - 728x90

Mismatched versions warning when updating Node.js/NPM in Docker

0 votes
1 answer
90 views
In our Dockerfile we have:
FROM ghcr.io/puppeteer/puppeteer:latest AS pdf
WORKDIR /puppeteer
USER root

# Prerequisites
RUN apt-get update && apt-get install nginx -y

# Update
RUN npm update
RUN npm update -g
RUN npm install -g npm

# Dependencies
RUN npm install puppeteer

# Run
COPY ./pdf.js .
RUN chmod u+x pdf.js
RUN service nginx start && ./pdf.js
This waits for Nginx to start and then runs a Node.js script (which crawls some pages on the Nginx webserver). Are the commands correct in # Update? Does the order of the commands matter, in order for it to update properly and fully? Node.js/NPM appears to update but throws the following warning in the console whilst it works (it takes some time):
#43 3.167 npm WARN EBADENGINE Unsupported engine {
#43 3.169 npm WARN EBADENGINE   package: 'corepack@0.28.0',
#43 3.170 npm WARN EBADENGINE   required: { node: '^18.17.1 || >=20.10.0' },
#43 3.172 npm WARN EBADENGINE   current: { node: 'v20.9.0', npm: '10.1.0' }
#43 3.174 npm WARN EBADENGINE }
How can we fix this warning about an unsupported engine/mismatched versions? I.E. how can we update from Node v20.9.0 to v20.10.0 (or latest)? Docker specifically recommend that you should use apt-get update in their best practices . Should we also be updating Node.js/NPM like the above? Could updating potentially cause any issues for our install of Google Puppeteer ? I.E. because those later versions are untested on puppeteer:latest by Google.
Asked by Danny Beckett (797 rep)
May 5, 2024, 04:12 PM
Last activity: May 6, 2024, 05:25 AM