edx-platform icon indicating copy to clipboard operation
edx-platform copied to clipboard

Upgrade Node JS from 16 to 20

Open abdullahwaheed opened this issue 1 year ago • 11 comments

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 avatar Mar 16 '23 09:03 abdullahwaheed

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

abdullahwaheed avatar May 24 '23 09:05 abdullahwaheed

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

jmbowman avatar Nov 27 '23 16:11 jmbowman

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 avatar Nov 27 '23 18:11 feanil

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 avatar Feb 08 '24 18:02 feanil

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

feanil avatar Feb 27 '24 19:02 feanil

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

abdullahwaheed avatar Feb 28 '24 10:02 abdullahwaheed

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 avatar Feb 28 '24 22:02 brian-smith-tcril

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 [email protected]: 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 avatar Feb 29 '24 00:02 brian-smith-tcril

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.

brian-smith-tcril avatar Feb 29 '24 14:02 brian-smith-tcril

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 avatar Jun 18 '24 14:06 feanil

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

feanil avatar Jun 25 '24 20:06 feanil