setup-node is a GitHub Action that configures a Node.js environment for workflows by downloading and caching a specified Node.js version.
The action solves the problem of reliably provisioning Node.js in CI/CD pipelines by handling version selection, caching, and dependency management. It checks a local cache first for semver-matching versions, then downloads from a curated release repository or falls back to the official Node.js distribution. Beyond version setup, it can cache npm, yarn, or pnpm dependencies, register problem matchers to surface build errors, and configure authentication for package registries including GPR and npm.
Teams running Node.js workflows on GitHub Actions should adopt this action to avoid manual version management and speed up builds through dependency caching. It suits any project using Node.js, from simple scripts to complex monorepos. The action supports flexible version syntax including semantic versioning, LTS aliases, and latest-release shortcuts. Caching behavior differs by package manager: npm caching is automatic when the package manager is declared in package.json, while yarn and pnpm require explicit cache configuration. Users with elevated privileges or access to sensitive data can disable automatic caching for security.
The project maintains active development with regular updates addressing breaking changes and feature improvements. Recent versions migrated internals to ESM for compatibility with current GitHub Actions packages. The action upgraded its runtime from Node 20 to Node 24, requiring runner version compatibility. Automatic dependency caching was introduced with package manager detection, though this can be disabled when needed. The dummy NODE_AUTH_TOKEN fallback was removed to prevent unintended .npmrc generation with non-functional tokens.