Using a specific version of NodeJS in Github Actions
This post is from April 2023; the example uses end-of-life Node.js 16 and an old version of actions/setup-node. Choose currently supported versions instead.
If you want to use a specific version of NodeJS in your Github Actions runner image, you don't have to install it yourself, just gotta ask it nicely. Here is how you can do it.
Just add a step that us using the actions/setup-node to choose the node version and you are good to go
jobs:
build:
----snip----
steps:
----snip----
- name: Use Node.js v16
uses: actions/setup-node@v2
with:
node-version: '16.x'