instructure / canvas-lms

The open LMS by Instructure, Inc.
https://github.com/instructure/canvas-lms/wiki
GNU Affero General Public License v3.0
5.42k stars 2.42k forks source link

Node.js 16 unsupported docker build fails #2253

Closed breiter closed 9 months ago

breiter commented 10 months ago

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.

RUN npm install -g npm@latest && npm cache clean --force

Steps to reproduce:

  1. check out the main branch of canvas-lms
  2. docker build .
  3. 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.

breiter commented 10 months ago

The rake canvas:compile_assets command fails to complete with nodejs 18.

COMPILE_ASSETS_NPM_INSTALL=0 COMPILE_ASSETS_BRAND_CONFIGS=0 bundle exec rake canvas:compile_assets
breiter commented 9 months ago

These commits seem to address this issue.

https://github.com/instructure/canvas-lms/commit/0f5c22ae8198520ea4197e87e8c361bb39fbffd7 https://github.com/instructure/canvas-lms/commit/2f611b17653fcbf1bcebcb06ea50952c2ebe1307