Skip to content

Enforce node version >= 22 for npm install#1234

Open
nbogie wants to merge 6 commits intoprocessing:2.0from
nbogie:nb-enforce-node-version
Open

Enforce node version >= 22 for npm install#1234
nbogie wants to merge 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

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