Navigate:
All Repossetup-node
~$SETUPN0.1%

setup-node: Configure Node.js in GitHub Actions

Node.js version management and dependency caching for workflows.

LIVE RANKINGS • 06:53 AM • STEADY
OVERALL
#173
4
CLOUD & DEVOPS
#11
3
30 DAY RANKING TREND
ovr#173
·Cloud#11
STARS
4.6K
FORKS
1.6K
DOWNLOADS
1
7D STARS
+5
7D FORKS
0
See Repo:
Share:

Learn more about setup-node

setup-node is a GitHub Actions utility that configures Node.js runtime environments within continuous integration workflows. It downloads and installs specified Node.js versions from official distribution channels, sets up the appropriate PATH environment variables, and optionally configures package manager caching layers for npm, yarn, or pnpm. The action supports version resolution through exact version numbers, semantic version ranges, or symbolic references like LTS release channels. It implements matrix strategy compatibility to enable parallel testing across multiple Node.js versions and operating systems within a single workflow definition. The caching mechanism stores dependency directories between workflow runs using GitHub's cache service to reduce installation time in subsequent executions.

setup-node

1

Dependency caching integration

Automatically detects and caches npm, yarn, or pnpm dependencies based on package manager configuration in package.json. Supports custom cache paths and multiple dependency file formats including package-lock.json, yarn.lock, and .tool-versions.

2

Version resolution flexibility

Accepts semantic versioning notation, version aliases (lts/*, latest, nightly, canary), and reads versions from multiple file formats (.nvmrc, .node-version, package.json). The check-latest option verifies available versions against the Node.js release repository.

3

Registry authentication configuration

Configures npm and yarn authentication at the project level through .npmrc and .yarnrc files, supporting both GPR (GitHub Package Registry) and custom npm registries via environment variables and token management.


// .github/workflows/test.yml
steps:
  - uses: actions/checkout@v4
  - uses: actions/setup-node@v4
    with:
      node-version: '20'
  - run: npm ci
  - run: npm test

vv6.0.0

Automatic caching now applies only to npm; yarn and pnpm require explicit cache configuration.

  • Update workflows to explicitly enable caching for yarn or pnpm if used, as automatic detection is removed.
  • Review dependency lock files to ensure npm is the package manager or add cache-dependency-path input.
vv5.0.0

Breaking: auto-caches dependencies when package.json declares packageManager; requires runner ≥v2.327.1 (Node 24).

  • Set package-manager-cache: false to disable new automatic caching if it conflicts with your workflow.
  • Upgrade your GitHub Actions runner to v2.327.1 or later before adopting this release.
vv3.9.1

Internal workflow change only; adds publishing automation for immutable action packages with no user-facing impact.

  • Release notes do not specify any breaking changes, new requirements, or migration steps for users.
  • No functional changes to setup-node behavior; update is safe to adopt without action.


[ EXPLORE MORE ]

Related Repositories

Discover similar tools and frameworks used by developers