Nodejs 16 has end of life in a few days time and now using npm9 to update to npm@latest fails with an error caused by line 67 in Dockerfile.js.
RUN npm install -g npm@latest && npm cache clean --force
Steps to reproduce:
check out the main branch of canvas-lms
docker build .
build fails
Expected behavior:
Build should succeed.
Actual behavior:
=> ERROR [6/7] RUN npm install -g npm@latest && npm cache clean --force 0.7s
------
> [6/7] RUN npm install -g npm@latest && npm cache clean --force:
0.680 npm ERR! code EBADENGINE
0.681 npm ERR! engine Unsupported engine
0.682 npm ERR! engine Not compatible with your version of node/npm: npm@10.0.0
0.682 npm ERR! notsup Not compatible with your version of node/npm: npm@10.0.0
0.682 npm ERR! notsup Required: {"node":"^18.17.0 || >=20.5.0"}
0.682 npm ERR! notsup Actual: {"npm":"8.19.4","node":"v16.20.2"}
0.684
0.684 npm ERR! A complete log of this run can be found in:
0.684 npm ERR! /root/.npm/_logs/2023-09-06T15_00_58_204Z-debug-0.log
Additional notes:
Changing line 36 of Dockerfile to use setup_18.x instead of setup_16.x succeeds. Alternatively keeping 16.x and changing @latest to @next-9 or @9.8.1 on line 67 also succeeds.
Summary:
Nodejs 16 has end of life in a few days time and now using npm9 to update to
npm@latest
fails with an error caused by line 67 in Dockerfile.js.Steps to reproduce:
Expected behavior:
Build should succeed.
Actual behavior:
Additional notes:
Changing line 36 of Dockerfile to use
setup_18.x
instead ofsetup_16.x
succeeds. Alternatively keeping16.x
and changing@latest
to@next-9
or@9.8.1
on line 67 also succeeds.