openedx / edx-platform

The Open edX LMS & Studio, powering education sites around the world!
https://openedx.org
GNU Affero General Public License v3.0
7.42k stars 3.88k forks source link

Upgrade Node JS from 16 to 20 #31937

Open abdullahwaheed opened 1 year ago

abdullahwaheed commented 1 year ago

Abstract ~Node 16's support will end on September 11, 2023. So we have to upgrade node JS to v18 before that.~ - We've now upgraded all released software to Node 18.

Node 18 support will end on Apr 2025. So we have to get to node 20 before Sumac.

Extras Project should use .nvmrc to have a consistent node version We have to update Readme accordingly.

Upgrade Node JS from 16 to 18

### Tasks
- [ ] https://github.com/openedx/wg-frontend/issues/105
- [ ] https://github.com/openedx/wg-frontend/issues/26
- [ ] https://github.com/openedx/edx-platform/pull/34311
- [ ] https://github.com/edx/edx-arch-experiments/issues/262#issuecomment-1845193450
- [ ] https://github.com/openedx/edx-platform/issues/35015
abdullahwaheed commented 1 year ago

We have to update outdated packages like webpack, karma, etc to properly shift it node 18. Otherwise it is breaking with peerDependency issues

jmbowman commented 11 months ago

There are several GitHub Action upgrades that haven't been merged yet, some of them state that they now use Node 20 as the default environment. Are we blocked on those upgrades until this is done, or can those be merged independently? https://github.com/openedx/edx-platform/pulls?q=is%3Apr+is%3Aopen+dependabot

feanil commented 11 months ago

Those can be merged independently because the environment the action uses for itself does not impact the version of node we setup for our testing during the run of the action.

feanil commented 8 months ago

Given that we need to get to Node 20 now anyway, I've updated this ticket to aim for Node 20 instead of Node 16

feanil commented 8 months ago

@abdullahwaheed can you quickly summarize what is blocking the upgrade from node 16 to node 18 that you've been working on so far?

abdullahwaheed commented 8 months ago

while upgrading to Node 18, we faced compatibility issues with some packages, that uses webpack, since edx-platform uses webpack 2 while currently webpack is at v5. More details can be found out here

brian-smith-tcril commented 8 months ago

The first thing I tried when looking into this was upgrading from node 16.14 to node 16.20

I encountered a few issues and worked through them (details in this PR: https://github.com/openedx/edx-platform/pull/34308)

One of the main issues is https://www.npmjs.com/package/karma-selenium-webdriver-launcher, which has "selenium-webdriver": "^2.44.0" as a peer dep, and edx-platform has "selenium-webdriver": "3.4.0", as a dev dep.

brian-smith-tcril commented 8 months ago

There's another issue with being able to regenerate package-lock.json because of the npm-shrinkwrap.json in edx-proctoring

https://github.com/openedx/edx-proctoring/blob/b73cf9f0689288a87fef58dcf90534b633737da4/npm-shrinkwrap.json#L4416-L4434

We should remove fsevents from that, as it causes npm ci to fail with

npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin"} (current: {"os":"linux"})
npm ERR! notsup Valid os:  darwin
npm ERR! notsup Actual os: linux

I'm currently working around this in my node 18 testing branch by manually removing it from the edx-platform package-lock.json file.

brian-smith-tcril commented 8 months ago

I made a draft PR upgrading to node 18 https://github.com/openedx/edx-platform/pull/34311

I've managed to get it to a point where webpack 5 builds everything properly, and most (but not all) of the js tests in CI are passing.

feanil commented 4 months ago

I've got a PR to add node 20, it looks like the current dependencies will work with both: https://github.com/openedx/edx-platform/pull/34998

feanil commented 4 months ago

Deprecation of Node 18 has been announced and will be accepted on July 4th