Skip to content

Enforce node version >= 22 for npm install#1234

Merged
ksen0 merged 6 commits intoprocessing:2.0from
nbogie:nb-enforce-node-version
Mar 16, 2026
Merged

Enforce node version >= 22 for npm install#1234
ksen0 merged 6 commits intoprocessing:2.0from
nbogie:nb-enforce-node-version

Conversation

@nbogie
Copy link
Contributor

@nbogie nbogie commented Mar 12, 2026

Addresses #1233

  • Specify node version >= 22 in engines in package.json
  • Add .npmrc to have npm error rather than warn when this is not met, using engine-strict=true
  • Mentioned this version requirement in docs/technical_overview.md.

As a result, npm install with a sub-22 version of node.js will give the following format of error:

npm error code EBADENGINE
npm error engine Unsupported engine
npm error engine Not compatible with your version of node/npm: p5.js-website@0.0.1
npm error notsup Not compatible with your version of node/npm: p5.js-website@0.0.1
npm error notsup Required: {"node":">=22.0.0"}
npm error notsup Actual:   {"npm":"10.6.2","node":"v18.12.0"}

why not devEngines?

Whilst devEngines is a good solution in future, it will be ignored by older platforms.

@nbogie
Copy link
Contributor Author

nbogie commented Mar 12, 2026

Website CI was using node v20 by default (it's not specified). I've updated it to explicitly use v22 for all steps in test.yml so far, which lets this PR pass.

Performance note: It'll be worth comparing the CI elapsed run-times for this PR against others to check it is no slower than when it was using the default from runs-on: ubuntu-latest. Investigate caching options there if it's significantly slower.

update: from the log, this is a good sign:

Run actions/setup-node@v4
Found in cache @ /opt/hostedtoolcache/node/22.22.0/x64

@ksen0
Copy link
Member

ksen0 commented Mar 16, 2026

Thanks, merging! (Is there a similar PR like that should target main?)

From your original issue: "a pointer to guide(s) on how to update version (e.g. for nvm)," that would be helpful, though the error output is relatively clear (below is the tail end of output when attempting to install with old version)

npm error code EBADENGINE
npm error engine Unsupported engine
npm error engine Not compatible with your version of node/npm: p5.js-website@0.0.1
npm error notsup Not compatible with your version of node/npm: p5.js-website@0.0.1
npm error notsup Required: {"node":">=22.0.0"}
npm error notsup Actual:   {"npm":"11.2.0","node":"v20.17.0"}
npm error A complete log of this run can be found in: [filepath]

@ksen0 ksen0 merged commit 7f06c7e into processing:2.0 Mar 16, 2026
4 checks passed
@nbogie nbogie deleted the nb-enforce-node-version branch March 16, 2026 13:18
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.

2 participants