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

deps: Upgrade to Node v16, in setup docs and in CI #5356

Merged
merged 1 commit into from
Apr 27, 2022

Conversation

gnprice
Copy link
Member

@gnprice gnprice commented Apr 22, 2022

I've been using this for local development for a few weeks now,
and all seems well. (That's longer than it needs to be; I just
hadn't come back to this to follow up.)

Node v12 is going EOL in just over a week, 2022-04-30, so it's
past time to make this upgrade official.

Also delete an old troubleshooting entry for a problem with Node v11
that was avoided by sticking to v10; and fix two other references to
Node v10 (where the problem was using an older version like v8) so
that they remain accurate now and for further upgrades in the future.

(At least until Node v1000. On Node's current release cadence, that
will happen in a little under 500 years. I think we can tolerate
having to tweak this check then.)

Fixes: #4263

@gnprice
Copy link
Member Author

gnprice commented Apr 22, 2022

Should wait to merge this one until CI passes, because this is a rare PR that touches the CI workflow config directly.

tools/test Outdated
@@ -192,12 +192,12 @@ check_node() {
local node_version
node_version="$(node --version)"
case "${node_version}" in
v1[0-9].*) ;;
v[1-9][0-9].* | v[1-9][0-9][0-9].*) ;;
Copy link
Member

Choose a reason for hiding this comment

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

v[1-9][0-9].* | v[1-9][0-9][0-9]* handles the v1000 problem.

But there’s a more standard solution: engines in package.json.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm interesting, thanks!

Taking the docs literally, it wouldn't actually do anything for us:

Unless the user has set the engine-strict config flag, this field is advisory only and will only produce warnings when your package is installed as a dependency.

because we're not getting installed as a dependency. But perhaps these docs aren't quite solid enough to take literally. I'll experiment.

Copy link
Member Author

Choose a reason for hiding this comment

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

Great, yeah, in reality it works. If I set it to >=20:

$ time yarn install
yarn install v1.22.17
[1/5] Validating package.json...
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=20". Got "14.18.3"
error Found incompatible module.

(I guess these docs are only claiming to document npm anyway, not yarn. Trying npm install, it seems to hang -- or maybe just takes a long time without producing much output -- and I don't feel like digging into it.)

@gnprice
Copy link
Member Author

gnprice commented Apr 22, 2022

CI passed; and did indeed get Node v16:

Run actions/setup-node@v2
Attempt to resolve the latest version from manifest...
Resolved as '16.14.2'
Found in cache @ /opt/hostedtoolcache/node/16.14.2/x64

@gnprice
Copy link
Member Author

gnprice commented Apr 26, 2022

(BTW I did post a revision applying Anders's feedback. I see I hadn't posted a comment saying so.)

Copy link
Member

@andersk andersk left a comment

Choose a reason for hiding this comment

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

Not sure if you were waiting for my review, but LGTM.

@@ -51,7 +51,7 @@ details to worry about.
Before starting, install these dependencies if you don't have them:
* [Git](https://git-scm.com/)
* [Node.js](https://nodejs.org/en/download/package-manager/): use the
**latest 12.x** version, not 14.x or later
**latest 16.x** version, or a later LTS version
* [Yarn](https://yarnpkg.com/en/docs/install), latest stable version
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean the latest Yarn 1.x (classic) version, by the way?

Copy link
Member Author

Choose a reason for hiding this comment

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

It does. I guess it'd be good to say that explicitly, though it looks like that URL continues to be about the classic versions.

Also I guess at some point we should look at migrating to the "modern" versions. For a while there it looked like a complex migration for something that wouldn't ultimately work for our form of deployment, and it seemed like the developers didn't even really understand why everything hadn't moved to their new model. But it looks like they now promise:
https://yarnpkg.com/getting-started/migration#step-by-step
that the new model isn't required, and that Yarn v2+ should be an improvement even while continuing to use node_modules.

Copy link
Member Author

Choose a reason for hiding this comment

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

Noted now: 75f20bf

@chrisbobbe
Copy link
Contributor

It also LGTM. 🙂

I've been using this for local development for a few weeks now,
and all seems well.  (That's longer than it needs to be; I just
hadn't come back to this to follow up.)

Node v12 is going EOL in just over a week, 2022-04-30, so it's
past time to make this upgrade official.

Also delete an old troubleshooting entry for a problem with Node v11
that was avoided by sticking to v10; and fix two other references to
Node v10 (where the problem was using an older version like v8) so
that they remain accurate now and for further upgrades in the future.

In particular, where we had been checking in our tests for Node v10+
(but in fact for >=10 and <20), just replace it with handy metadata
in our package.json to make Yarn (or `npm`) complain at install time.
Thanks to Anders Kaseorg for pointing out that package.json feature.

Fixes: zulip#4263
@gnprice gnprice merged commit 70cf310 into zulip:main Apr 27, 2022
@gnprice
Copy link
Member Author

gnprice commented Apr 27, 2022

Thanks for the reviews! Merged.

@gnprice gnprice deleted the pr-node-16 branch April 27, 2022 21:18
gnprice added a commit that referenced this pull request Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade to Node ~v14~ v16
3 participants