Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move from node 16 to node >=18 #12711

Merged
merged 13 commits into from
Aug 28, 2023
Merged

Move from node 16 to node >=18 #12711

merged 13 commits into from
Aug 28, 2023

Conversation

paul-marechal
Copy link
Member

@paul-marechal paul-marechal commented Jul 13, 2023

What it does

Update our CI/CD to run using Node.js 18.x and 20.x.

Update macaddress to include the fix for Node.js 18.x.

Closes #11220

How to test

Everything should run as usual? CI/CD should be green.

Review checklist

Reminder for reviewers

@paul-marechal paul-marechal added ci issues related to CI / tests dependencies pull requests that update a dependency file potentially-breaking A change that might break some dependents conditionally labels Jul 13, 2023
@paul-marechal
Copy link
Member Author

paul-marechal commented Jul 13, 2023

OK there's something weird going on with the CI runners and I won't have much time to troubleshoot this.

I don't get any of the errors the Windows workflow has, even when starting from a fresh clone.

The /bin/sh: 1: theia: not found errors on Ubuntu/Mac are also odd as they imply that yarn doesn't do a good job of exposing npm bins to package.json scripts? I'd need someone to try on their own Ubuntu machine to check...

Help is welcome here.

@rahulgupta-acquia
Copy link

@paul-marechal Could you please rebase this repo, this repo has some conflicts that needs to fixed for testing.

@rahulgupta-acquia
Copy link

@paul-marechal could you please suggest a way to test this build in my local ( MAC ) system,

I followed the below steps for setup https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md#quick-start

git clone https://github.com/eclipse-theia/theia \
    && cd theia \
    && yarn \
    && yarn download:plugins \
    && yarn browser build \
    && yarn browser start

but after cloning and yarn install, it throws the

 $ yarn download:plugins
command not found: theia

@paul-marechal
Copy link
Member Author

paul-marechal commented Jul 26, 2023

@rahulgupta-acquia well the fact that it doesn't work is the issue I was asking help with... But looking at the logs again I might have figured it out: See latest commit.

@rahulgupta-acquia
Copy link

@rahulgupta-acquia well the fact that it doesn't work is the issue I was asking help with... But looking at the logs again I might have figured it out: see latest commit.

yes, i checked yarn add global node-gyp is required for further steps.

@paul-marechal
Copy link
Member Author

@rahulgupta-acquia you mean that it worked for you when using yarn global add node-gyp before doing yarn install?

@rahulgupta-acquia
Copy link

@rahulgupta-acquia you mean that it worked for you when using yarn global add node-gyp before doing yarn install?

No, i am facing issue at the time of yarn download;plugin.

I think my issue is not related to this PR.

@rahulgupta-acquia
Copy link

@paul-marechal Do you have any document or steps to test this PR in Local system (MAC)?

@paul-marechal
Copy link
Member Author

@rahulgupta-acquia
Copy link

I need to build IDE using this PR.

@rahulgupta-acquia
Copy link

@paul-marechal Once this CI/CD success, Do we say Theia is supported Node >=18?

@paul-marechal
Copy link
Member Author

@rahulgupta-acquia I'd like for other contributors to check for regressions before proceeding but yes!

@kittaakos
Copy link
Contributor

Thanks for the update. Could you please adjust the developer readme? Thanks

- Node.js `>= 16.14.0` and `< 17`.

@paul-marechal
Copy link
Member Author

IP v6 addresses were being used over IP v4 but I found a way to get back to the previous behaviour using dns.setDefaultResultOrder('ipv4first')

Copy link

@rahulgupta-acquia rahulgupta-acquia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the code changes.

@rahulgupta-acquia
Copy link

@paul-marechal Could you please rebase this repo.
Thanks

@paul-marechal paul-marechal force-pushed the mp/node-18 branch 2 times, most recently from 483e0a2 to 73b51e2 Compare July 27, 2023 17:13
@rahulgupta-acquia
Copy link

@paul-marechal code rebase needed.

@msujew @tsmaeder @vince-fugnitto Request for review.

Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to upgrade the node version here as well. I also agree with Vince, that as long VSCode extensions are using Node 16, that we should use 16 in our testing matrix as well.

Otherwise this looks pretty good to me 👍

Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good to me 👍

@vince-fugnitto Do we want to include this in the upcoming release?

@vince-fugnitto
Copy link
Member

@vince-fugnitto Do we want to include this in the upcoming release?

Sounds good to me!

@vince-fugnitto vince-fugnitto merged commit 2d31490 into master Aug 28, 2023
12 checks passed
@vince-fugnitto vince-fugnitto deleted the mp/node-18 branch August 28, 2023 13:19
@github-actions github-actions bot added this to the 1.41.0 milestone Aug 28, 2023
@@ -4,17 +4,17 @@
"version": "0.0.0",
"engines": {
"yarn": ">=1.7.0 <2",
"node": ">=16.14.0 <17"
"node": ">=16"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious: the Developing.md was updated to say developers should use >= 18.17 and < 21. But this line says >= 16. Why that discrepancy?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we generally recommend the version range that you've mentioned, there is no technical reason for limiting it to that range. Though we know that < 16.0.0 doesn't work due to native dependencies. 18.17.0 is specifically the recommended minimum version because that's the version that our Electron version uses.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We recommend a certain version range in our documentation as we try to make sure it works for said range.

This engines.node field will have Yarn stop the build if you use anything outside the defined range, and I might have left it lax so that it's more convenient when switching between node versions for development purposes.

Most other NPM projects -including our deps- are also pretty lax with this range (click to expand).

But we could move the lower bound along the minimum recommended version.

At the very minimum we need to update this range based on the kind of constructs we use from NodeJS: we can't use new Node 18 syntax and claim that we require anything below Node 18 to run our code base. Although syntax-wise we're dependent on our TypeScript compilation target: No matter what TS syntax we use tsc will "dumb it down" for us in the output JS based on our configs. We're currently targeting ES2019 and it seems like Node 16 supports it very well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the long run it's in everyone's best interest to always use the latest Node LTS, but some might still lag behind so the range can accommodate for it somewhat.

Now I remember: Had I updated the range to >=18 for that release then all users of the framework would have had build issues because they most likely were still running on Node 16 at that point. So instead of breaking everyone on release I kept it that way so people can update when they're ready. It's not like the project will stop working on Node 16 right away :)

@jcortell68
Copy link
Contributor

jcortell68 commented Nov 2, 2023

Thanks guys. That was very enlightening. So if I had to summarize the sum of the messages and maybe read between the lines a little, this is what I think is being said:

At this point in time:

  • there are no issues building Theia with Node 16
  • there are no known issues running Theia with Node 16 (but in theory there could be issues lurking or unreported)
  • the version of Node that the version of Electron Theia uses is Node 18.17
  • the Theia project is not actively trying to stay compatible with Node 16, and thus to avoid potential breakage in the future, adopters should use v18 or greater
  • in general, using the latest Node LTS is ideal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci issues related to CI / tests dependencies pull requests that update a dependency file potentially-breaking A change that might break some dependents conditionally
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

future: support Node 18
6 participants