Skip to content

Configure npm to enforce standard project Node.js version #791

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

Merged
merged 2 commits into from
Oct 16, 2024

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Oct 16, 2024

This will produce an error if a contributor attempts to run an npm command in the project using an unsupported version
of Node.js.

This will produce an error if a contributor attempts to run an npm command in the project using an unsupported version
of Node.js.
The "Check Website" workflow invokes the following chain of tasks:

1. `website:check`
2. `docs:generate`
3. `general:format-prettier`

This makes the Prettier tool a dependency of the workflow, which in turn introduces a dependency on npm, and thus on
Node.js.

Previously, the workflow didn't contain a step to run the "actions/setup-node" action, so it used whichever version of
npm happened to be installed in the runner machine, which happens to be 18.x currently. Now that the use of the
project's standard Node.js version 20.x is enforced, this caused the workflow to fail spuriously:

```
task: [npm:install-deps] npm install
npm error code EBADENGINE
npm error engine Unsupported engine
npm error engine Not compatible with your version of node/npm: undefined
npm error notsup Not compatible with your version of node/npm: undefined
npm error notsup Required: {"node":"20.x"}
npm error notsup Actual:   {"npm":"10.7.0","node":"v18.20.4"}
```

The problem is solved by adding an "actions/setup-node" action step to the workflow to install the correct version of
Node.js.
@per1234 per1234 added type: enhancement Proposed improvement topic: infrastructure Related to project infrastructure labels Oct 16, 2024
@per1234 per1234 self-assigned this Oct 16, 2024
@per1234 per1234 merged commit 37dbf5b into arduino:main Oct 16, 2024
16 checks passed
@per1234 per1234 deleted the enforce-node_js-version branch October 16, 2024 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: infrastructure Related to project infrastructure type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant