nodejs/install 1.1.5

Install Node.js, the cross-platform JavaScript runtime environment

Parameters

Parameter
Required
Default
Description
node-version
Version of node to install.
node-version-file
Path to node version file, eg. .node-version, .nvmrc, .tool-versions.

README.md

You'll either need to specify node-version or node-version-file

Specifying node-version

tasks:
  - key: node
    call: nodejs/install 1.1.5
    with:
      node-version: "21.4.0"

.node-version file

Or with a file named .node-version containing the version of node to install:

tasks:
  - key: node
    use: code # or whichever task provides the .node-version file
    call: nodejs/install 1.1.5
    with:
      node-version-file: .node-version
    filter:
      - .node-version

This example contains use: code. It's common to have a task with key code that uses the git-clone leaf to clone your repository, but if your task that provides the .node-version file is named something else, you'll need to replace use: code with the appropriate task.

Remember to include the filter so that the task will be cached based only on the contents of .node-version.