Repository navigation
Update to Node.js 20.x - #56331
Update to Node.js 20.x#56331
Conversation
|
Flaky tests detected in 2bfa462. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7278268036
|
|
I'm trying to make myself familiar with what it takes to update the Node.js version for Gutenberg.
What other blockers do you have in mind besides the build server for shipping? Also cross-referencing #55561 |
I can't see any at the moment since this PR seems to work without issue. But it's possible there are considerations buried deeper in the Gutenberg code I'm not aware of. I've tagged @gziolo for a review since he's helped me review these changes in the past. Also, I've made a request to the systems team to install 20.x on the build server. It's possible we can skip 18.x all together, though I'd advise we proceed as though we'll only have 18.x available for this current cycle (WP 6.5). We can always bump a second time should something change. |
|
@desrosj, as simple as that? We have come a long way 😄 In the past, we were forcing a specific npm major version, or even always checking with the most recent version on CI. However, this PR makes me think that it's probably no longer a case and finally folks should be able any version they like locally. Let's observe whether it won't trigger some random lock file changes in PRs opened, and only consider imposing limitations if something goes wrong. That's said let me test this branch locally with Node 20 and a higher version of npm. I'm sure there are a few instances of documentation where we force contributors to use Node 16 and npm 8, so we should update them, too. |
gziolo
left a comment
There was a problem hiding this comment.
I tested locally with Node.js v20 and npm v10 and it works like a charm.
I found only two occurrences of documentation pages that need to be reworded:
gutenberg/platform-docs/docs/intro.md
Line 12 in 9484890
There might be more instances, but it looks like some of them were updated recently with the focus on using the Active LTS version 🥇
99b00ca to
87ee195
Compare
I added 87ee195 – let me know what you think. I tried to include a passage about the goal of using of active LTS version of Node.js but can be removed if it's not suitable. Also did a rebase. |
|
Looks like 20.x was just installed on the .org build server. 🎉 I've updated the PR to skip 18.x. There is a failure that seems to be related to the version of Node/npm available on the Action Runner image. I've also updated the corresponding Core PR to use 20.x. |
Yeah, I think the compressed size check compares the current PR with trunk. Since trunk currently has the older engines field, but the action runner will use Node 20, we get the conflict. So it should disappear after merging to trunk! (And once PRs incorporate these changes as well.) I don't think a plugin release is needed for that. |
|
Nice, the Compressed Size job always fails when upgrading the Node version, but it works after landing the PR. We can ignore it and hope for the best 😄 |
|
Great to see this at the finish line 🎉 |
|
@desrosj is there any plan to update node / npm for Core as well? |
|
@afercia the Core update was also coordinated and both code bases are now on Node.js 20. See the announcement post for more details. |
Ports trunk's `415ecc997f03c97f92a201fc83c3b2b8191d8b4a` ("Update to
Node.js 20.x", WordPress#56331, merged 2023-12-20), the
commit that moved trunk's own `.nvmrc` from `16` to `20` shortly
after this branch was cut. WordPress core's own build tooling made
the equivalent move the same day (`wordpress-develop` commit
`d522886b27ce8b8a6b9471b53e15360525b0b006`, "Build/Test Tools: Raise
minimum required version of Node.js/npm"), so this branch's pinned
Node version was left behind core's own by only a few weeks.
Unlike trunk's commit, this branch's own `update-actions-to-latest`
and `single-node-version-testing` layers already collapsed every
workflow's Node-version matrix down to a single `node-version-file:
'.nvmrc'" reference and already removed `check-latest: true", so
none of trunk's accompanying workflow-matrix/`check-latest` churn
applies here — bumping `.nvmrc` is sufficient to move every job.
`package.json`'s and `package-lock.json`'s `engines` fields are
updated to match trunk's own values (`>=20.10.0`/`>=10.2.3`); no
dependency was bumped, as none was needed (see the PR body for the
verification this rested on). The two contributor-facing docs that
cite a specific Node.js version are updated to match, mirroring
trunk's own wording change.
Ports trunk's `415ecc997f03c97f92a201fc83c3b2b8191d8b4a` ("Update to
Node.js 20.x", WordPress#56331, merged 2023-12-20), the
commit that moved trunk's own `.nvmrc` from `16` to `20` shortly
after this branch was cut. WordPress core's own build tooling made
the equivalent move the same day (`wordpress-develop` commit
`d522886b27ce8b8a6b9471b53e15360525b0b006`, "Build/Test Tools: Raise
minimum required version of Node.js/npm"), so this branch's pinned
Node version was left behind core's own by only a few weeks.
Unlike trunk's commit, this branch's own `update-actions-to-latest`
and `single-node-version-testing` layers already collapsed every
workflow's Node-version matrix down to a single `node-version-file:
'.nvmrc'" reference and already removed `check-latest: true", so
none of trunk's accompanying workflow-matrix/`check-latest` churn
applies here — bumping `.nvmrc` is sufficient to move every job.
`package.json`'s and `package-lock.json`'s `engines` fields are
updated to match trunk's own values (`>=20.10.0`/`>=10.2.3`); no
dependency was bumped, as none was needed (see the PR body for the
verification this rested on). The two contributor-facing docs that
cite a specific Node.js version are updated to match, mirroring
trunk's own wording change.
Ports trunk's `415ecc997f03c97f92a201fc83c3b2b8191d8b4a` ("Update to
Node.js 20.x", WordPress#56331, merged 2023-12-20), the
commit that moved trunk's own `.nvmrc` from `16` to `20` shortly
after this branch was cut. WordPress core's own build tooling made
the equivalent move the same day (`wordpress-develop` commit
`d522886b27ce8b8a6b9471b53e15360525b0b006`, "Build/Test Tools: Raise
minimum required version of Node.js/npm"), so this branch's pinned
Node version was left behind core's own by only a few weeks.
Unlike trunk's commit, this branch's own `update-actions-to-latest`
and `single-node-version-testing` layers already collapsed every
workflow's Node-version matrix down to a single `node-version-file:
'.nvmrc'" reference and already removed `check-latest: true", so
none of trunk's accompanying workflow-matrix/`check-latest` churn
applies here — bumping `.nvmrc` is sufficient to move every job.
`package.json`'s and `package-lock.json`'s `engines` fields are
updated to match trunk's own values (`>=20.10.0`/`>=10.2.3`); no
dependency was bumped, as none was needed (see the PR body for the
verification this rested on). The two contributor-facing docs that
cite a specific Node.js version are updated to match, mirroring
trunk's own wording change.
Ports trunk's `415ecc997f03c97f92a201fc83c3b2b8191d8b4a` ("Update to
Node.js 20.x", WordPress#56331, merged 2023-12-20), the
commit that moved trunk's own `.nvmrc` from `16` to `20` shortly
after this branch was cut. WordPress core's own build tooling made
the equivalent move the same day (`wordpress-develop` commit
`d522886b27ce8b8a6b9471b53e15360525b0b006`, "Build/Test Tools: Raise
minimum required version of Node.js/npm"), so this branch's pinned
Node version was left behind core's own by only a few weeks.
Unlike trunk's commit, this branch's own `update-actions-to-latest`
and `single-node-version-testing` layers already collapsed every
workflow's Node-version matrix down to a single `node-version-file:
'.nvmrc'" reference and already removed `check-latest: true", so
none of trunk's accompanying workflow-matrix/`check-latest` churn
applies here — bumping `.nvmrc` is sufficient to move every job.
`package.json`'s and `package-lock.json`'s `engines` fields are
updated to match trunk's own values (`>=20.10.0`/`>=10.2.3`); no
dependency was bumped, as none was needed (see the PR body for the
verification this rested on). The two contributor-facing docs that
cite a specific Node.js version are updated to match, mirroring
trunk's own wording change.
Ports trunk's `415ecc997f03c97f92a201fc83c3b2b8191d8b4a` ("Update to
Node.js 20.x", WordPress#56331, merged 2023-12-20), the
commit that moved trunk's own `.nvmrc` from `16` to `20` shortly
after this branch was cut. WordPress core's own build tooling made
the equivalent move the same day (`wordpress-develop` commit
`d522886b27ce8b8a6b9471b53e15360525b0b006`, "Build/Test Tools: Raise
minimum required version of Node.js/npm"), so this branch's pinned
Node version was left behind core's own by only a few weeks.
Unlike trunk's commit, this branch's own `update-actions-to-latest`
and `single-node-version-testing` layers already collapsed every
workflow's Node-version matrix down to a single `node-version-file:
'.nvmrc'" reference and already removed `check-latest: true", so
none of trunk's accompanying workflow-matrix/`check-latest` churn
applies here — bumping `.nvmrc` is sufficient to move every job.
`package.json`'s and `package-lock.json`'s `engines` fields are
updated to match trunk's own values (`>=20.10.0`/`>=10.2.3`); no
dependency was bumped, as none was needed (see the PR body for the
verification this rested on). The two contributor-facing docs that
cite a specific Node.js version are updated to match, mirroring
trunk's own wording change.
Ports trunk's `415ecc997f03c97f92a201fc83c3b2b8191d8b4a` ("Update to
Node.js 20.x", WordPress#56331, merged 2023-12-20), the
commit that moved trunk's own `.nvmrc` from `16` to `20` shortly
after this branch was cut. WordPress core's own build tooling made
the equivalent move the same day (`wordpress-develop` commit
`d522886b27ce8b8a6b9471b53e15360525b0b006`, "Build/Test Tools: Raise
minimum required version of Node.js/npm"), so this branch's pinned
Node version was left behind core's own by only a few weeks.
Unlike trunk's commit, this branch's own `update-actions-to-latest`
and `single-node-version-testing` layers already collapsed every
workflow's Node-version matrix down to a single `node-version-file:
'.nvmrc'" reference and already removed `check-latest: true", so
none of trunk's accompanying workflow-matrix/`check-latest` churn
applies here — bumping `.nvmrc` is sufficient to move every job.
`package.json`'s and `package-lock.json`'s `engines` fields are
updated to match trunk's own values (`>=20.10.0`/`>=10.2.3`); no
dependency was bumped, as none was needed (see the PR body for the
verification this rested on). The two contributor-facing docs that
cite a specific Node.js version are updated to match, mirroring
trunk's own wording change.
Ports trunk's `415ecc997f03c97f92a201fc83c3b2b8191d8b4a` ("Update to
Node.js 20.x", WordPress#56331, merged 2023-12-20), the
commit that moved trunk's own `.nvmrc` from `16` to `20` shortly
after this branch was cut. WordPress core's own build tooling made
the equivalent move the same day (`wordpress-develop` commit
`d522886b27ce8b8a6b9471b53e15360525b0b006`, "Build/Test Tools: Raise
minimum required version of Node.js/npm"), so this branch's pinned
Node version was left behind core's own by only a few weeks.
Unlike trunk's commit, this branch's own `update-actions-to-latest`
and `single-node-version-testing` layers already collapsed every
workflow's Node-version matrix down to a single `node-version-file:
'.nvmrc'" reference and already removed `check-latest: true", so
none of trunk's accompanying workflow-matrix/`check-latest` churn
applies here — bumping `.nvmrc` is sufficient to move every job.
`package.json`'s and `package-lock.json`'s `engines` fields are
updated to match trunk's own values (`>=20.10.0`/`>=10.2.3`); no
dependency was bumped, as none was needed (see the PR body for the
verification this rested on). The two contributor-facing docs that
cite a specific Node.js version are updated to match, mirroring
trunk's own wording change.
Ports trunk's `415ecc997f03c97f92a201fc83c3b2b8191d8b4a` ("Update to
Node.js 20.x", WordPress#56331, merged 2023-12-20), the
commit that moved trunk's own `.nvmrc` from `16` to `20` shortly
after this branch was cut. WordPress core's own build tooling made
the equivalent move the same day (`wordpress-develop` commit
`d522886b27ce8b8a6b9471b53e15360525b0b006`, "Build/Test Tools: Raise
minimum required version of Node.js/npm"), so this branch's pinned
Node version was left behind core's own by only a few weeks.
Unlike trunk's commit, this branch's own `update-actions-to-latest`
and `single-node-version-testing` layers already collapsed every
workflow's Node-version matrix down to a single `node-version-file:
'.nvmrc'" reference and already removed `check-latest: true", so
none of trunk's accompanying workflow-matrix/`check-latest` churn
applies here — bumping `.nvmrc` is sufficient to move every job.
`package.json`'s and `package-lock.json`'s `engines` fields are
updated to match trunk's own values (`>=20.10.0`/`>=10.2.3`); no
dependency was bumped, as none was needed (see the PR body for the
verification this rested on). The two contributor-facing docs that
cite a specific Node.js version are updated to match, mirroring
trunk's own wording change.
Ports trunk's `415ecc997f03c97f92a201fc83c3b2b8191d8b4a` ("Update to
Node.js 20.x", WordPress#56331, merged 2023-12-20), the
commit that moved trunk's own `.nvmrc` from `16` to `20` shortly
after this branch was cut. WordPress core's own build tooling made
the equivalent move the same day (`wordpress-develop` commit
`d522886b27ce8b8a6b9471b53e15360525b0b006`, "Build/Test Tools: Raise
minimum required version of Node.js/npm"), so this branch's pinned
Node version was left behind core's own by only a few weeks.
Unlike trunk's commit, this branch's own `update-actions-to-latest`
and `single-node-version-testing` layers already collapsed every
workflow's Node-version matrix down to a single `node-version-file:
'.nvmrc'" reference and already removed `check-latest: true", so
none of trunk's accompanying workflow-matrix/`check-latest` churn
applies here — bumping `.nvmrc` is sufficient to move every job.
`package.json`'s and `package-lock.json`'s `engines` fields are
updated to match trunk's own values (`>=20.10.0`/`>=10.2.3`); no
dependency was bumped, as none was needed (see the PR body for the
verification this rested on). The two contributor-facing docs that
cite a specific Node.js version are updated to match, mirroring
trunk's own wording change.
Ports trunk's `415ecc997f03c97f92a201fc83c3b2b8191d8b4a` ("Update to
Node.js 20.x", WordPress#56331, merged 2023-12-20), the
commit that moved trunk's own `.nvmrc` from `16` to `20` shortly
after this branch was cut. WordPress core's own build tooling made
the equivalent move the same day (`wordpress-develop` commit
`d522886b27ce8b8a6b9471b53e15360525b0b006`, "Build/Test Tools: Raise
minimum required version of Node.js/npm"), so this branch's pinned
Node version was left behind core's own by only a few weeks.
Unlike trunk's commit, this branch's own `update-actions-to-latest`
and `single-node-version-testing` layers already collapsed every
workflow's Node-version matrix down to a single `node-version-file:
'.nvmrc'" reference and already removed `check-latest: true", so
none of trunk's accompanying workflow-matrix/`check-latest` churn
applies here — bumping `.nvmrc` is sufficient to move every job.
`package.json`'s and `package-lock.json`'s `engines` fields are
updated to match trunk's own values (`>=20.10.0`/`>=10.2.3`); no
dependency was bumped, as none was needed (see the PR body for the
verification this rested on). The two contributor-facing docs that
cite a specific Node.js version are updated to match, mirroring
trunk's own wording change.

What?
This updates the version of Node.js used in the repository from 16.x to 18.x.
Why?
16.x is now EOL as of September 11, 2023.
While it's true that 20.x is the current active version of Node.js, there are external circumstances that prevent WordPress Core from using Node.js 20.x at this time. Mainly, the WordPress.org build server that is responsible for building, bundling, and packaging what is eventually shipped as the WordPress software needs to have the version of Node.js specified in the
package.jsonfile installed.The newest version of Node.js present on that server is currently 18.18.0. Though 20.x is the current version, 18.x is still supported as a maintenance LTS through April 20, 2025. For the time being, let's update to use 18.x so that the project is using a version actively supported by the Node.js team.
Even though we're unable to officially use 20.x to build the finished packages, I think it's still reasonable to allow it's usage and to test against it in our GitHub Action workflows to ensure compatibility with both versions. This PR defines
18as the preferred version within the.nvmrcfile and the minimum requirement in thepackage.jsonfile. But it removes the upper limit that was there previously for npm. In my testing, I did not find any problems with allowing both versions, and in general the code here appears to be unaffected by any of the problematic changes between the two versions (though there may be some not discovered through current testing).This is a companion to WordPress/wordpress-develop#5515, which should be committed shortly after this is merged.