#56658 closed task (blessed) (fixed)
Make build process compatible with newer versions of NodeJS/npm
Reported by: | desrosj | Owned by: | desrosj |
---|---|---|---|
Milestone: | 6.4 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch |
Focuses: | Cc: |
Description (last modified by )
The build scripts and processes currently require NodeJS 14.x and NPM < 7 (6.x).
Some notes:
- NodeJS 14.x is currently in the maintenance phase, which ends April, 30, 2023.
- NodeJS 16.x (the current LTS version) enters the maintenance phase on October 18, 2022.
- NodeJS 18.x enters LTS on October 25, 2022.
- NPM 7 introduces a new lock file format (see #52951).
- NPM 8 had only one notable breaking change, dropping support for NodeJS 10.
- Twenty Nineteen, Twenty Twenty, and Twenty Twenty-One all have their own
package.json
files and are set up to run on NodeJS14.x
. These should probably be updated as well so that the version required is consistent.
Change History (29)
This ticket was mentioned in Slack in #core by desrosj. View the logs.
2 years ago
#5
@
2 years ago
- Milestone changed from 6.2 to 6.3
Unfortunately, I haven't had the time to make any progress on this for 6.2.
Going to punt, but to 6.3 as this needs to be done before the maintenance window for 14.x ends in April.
@gziolo is back from his leave, so I'm going to make an effort to tackle this with him in Gutenberg and Core in the coming weeks.
#6
@
20 months ago
Noting here that 16.x
is scheduled for EOL on September 11, 2023, moved forward seven months sooner, as explained in this announcement (full schedule).
#7
@
18 months ago
- Milestone changed from 6.3 to 6.4
This is not going to be done for 6.3.
In speaking with @youknowriad the last few weeks, the plan is to address this before the end of July accompanied by a post on Making WordPress Core.
This ticket was mentioned in PR #4028 on WordPress/wordpress-develop by @desrosj.
18 months ago
#9
- Keywords has-patch added
This updates the version of NodeJS used for WordPress Core to 16.x.
18.x is not currently an option because of system level adjustments that need to be made in order for the build server and other .org infrastructure to properly support 18.x. See this post for more context.
Trac ticket: https://core.trac.wordpress.org/ticket/56658
@swissspidy commented on PR #4028:
18 months ago
#10
https://github.com/WordPress/gutenberg/pull/53426 was just merged in Gutenberg to bump to Node 16 🎉
So let's make it happen 🚀
18 months ago
#11
It's very likely that we will have to use the following config line here as well:
https://github.com/WordPress/gutenberg/blob/4a24e8560cb5c277ea90631ad81e3453933bc27e/.npmrc#L3
legacy-peer-deps = true
18 months ago
#12
Flagged for review from a few folks that showed interest in this.
I've gone and merged in the latest trunk
, and also added legacy-peer-deps
.
One thing I'd like to confirm before merging this is why there are changes in the src/wp-includes
folder as a result. My hunch is that there is an update to uuid
being applied that is the reason.
@swissspidy commented on PR #4028:
18 months ago
#13
One thing I'd like to confirm before merging this is why there are changes in the
src/wp-includes
folder as a result. My hunch is that there is an update touuid
being applied that is the reason.
Just picked wordcount.js
to look at, because it has a changed hash as well. I ran npm run build:dev
on trunk and then on this PR. All the diffs were just because functions were replaced with arrow functions:
(left is trunk, right is this PR)
@youknowriad commented on PR #4028:
18 months ago
#14
I'm guessing that the update of the package-lock.json also updated some packages and among these packages is probably browser-list which includes the browser usage which probably changed slightly making arrow functions a syntax that is supported in all the supported browsers so it's not transpiled anymore.
I think that's fine.
18 months ago
#15
@swissspidy, what if you run npx browserslist@latest --update-db
in both places? Beside, it's very likely that we see a different set of dependencies in both branches, including webpack. I also think that Node 16 is using a different hashing algorithm by default so it would also impact the versions calculated for packages. I remember some fixes in Gutenberg for Node 17 and above like https://github.com/WordPress/gutenberg/issues/36471.
18 months ago
#17
Resolving some of the vulnerabilities reported in this commit or with a follow-up would be great.
Agreed! I plan to do a follow-up commit that upgrades all other dependencies to their latest versions that were not specifically required to make this upgrade work.
Thanks everyone! I'll get this committed shortly.
#19
@
18 months ago
I've published a note about this on Making WordPress Core: https://make.wordpress.org/core/2023/08/09/updating-wordpress-to-use-more-modern-versions-of-node-js-npm/.
It's likely there will be some documentation and handbook updates required. I called that out in the post and asked folks to call them out in appropriate locations.
18 months ago
#20
Merged in Core-56378. Post also published. Thanks all!
This ticket was mentioned in Slack in #core by lkraav. View the logs.
18 months ago
#23
@
17 months ago
@desrosj I assume that in README should be written:
Note: WordPress currently only officially supports Node.js 16.x (16.19.1 and higher) and npm 8.x.
I tried to use 16.13.1 and only from the error message got the correct number.
#27
@
16 months ago
This is latest trunk as of r56831 and node 18 lts. Seems that npm v9 is the blocker.
$ npm ci npm ERR! code EBADENGINE npm ERR! engine Unsupported engine npm ERR! engine Not compatible with your version of node/npm: WordPress@6.4.0 npm ERR! notsup Not compatible with your version of node/npm: WordPress@6.4.0 npm ERR! notsup Required: {"node":">=16.19.1","npm":">=8.19.3 <9"} npm ERR! notsup Actual: {"npm":"9.6.4","node":"v18.12.1"} $ node -v v18.12.1 $ npm -v 9.6.4
#28
@
15 months ago
@benharri updating to 18.x is currently unsupported (as of WordPress 6.4).
Please follow #59663 for progress towards allowing 18.x.
#29
@
15 months ago
ah I must've read the wrong page! I was following this local setup guide https://learn.wordpress.org/tutorial/installing-node-js-and-npm-for-local-wordpress-development/
Since
18.x
will enter LTS in late October, it may make sense to skip transitioning to16.x
all together. However, it's possible that some dependencies will need a bit more time to release a version that supports18.x
, so a two phase update may also be reasonable.