setup-node: Configure Node.js in GitHub Actions
Node.js version management and dependency caching for workflows.
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.
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.
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.
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 testUpdates documentation and fixes various typos and mirror option issues
- –Documentation update related to absence of Lockfile
- –Correct mirror option typos
- –Readme update on checkout version v6
- –Advanced document update on checkout version v6
Removes always-auth configuration handling and upgrades dependencies
- –Remove always-auth configuration handling
- –Upgrade @actions/cache from 4.0.3 to 4.1.0
- –Upgrade actions/checkout from 5 to 6
- –Upgrade js-yaml from 3.14.1 to 3.14.2
- –Add example for restore-only cache in documentation
Limits automatic caching to npm only and includes breaking changes documentation
- –Limit automatic caching to npm, update workflows and documentation
- –Upgrade ts-jest from 29.1.2 to 29.4.1 and document breaking changes in v5
- –Upgrade prettier from 2.8.8 to 3.6.2
- –Upgrade actions/publish-action from 0.3.0 to 0.4.0
Related Repositories
Discover similar tools and frameworks used by developers
Configure AWS Credentials
GitHub Action for AWS credential resolution in workflows.
Docker Compose
YAML-defined container lifecycle management and orchestration tool.
Dockge
Self-hosted Docker Compose manager with real-time terminal streaming.
Self-Hosting Guide
Guide for self-hosted software, infrastructure, networking, and automation tools.
AWS CDK
Programming language abstractions that synthesize into CloudFormation templates.
Related Reading
Guides and comparisons from the Greptile content library
Top AI Code Review Tools for Small Dev Teams 2026
Affordable, lightweight AI code review tools that help small teams catch bugs faster. Practical comparisons of accuracy, ease of use, and value for teams without enterprise budgets.
Best Developer Productivity Tools in 2026
The best developer productivity tools in 2026, compared by the workflow problem they solve: code review, autocomplete, AI-native editing, terminal agents, code search, observability, and security.
API Security: What It Is, Why It Matters, and 7 Best Practices for 2026
What API security is, the OWASP API Security Top 10 risks with real examples from open source PRs, seven best practices to start with, and how to test your APIs with static scanning, dynamic testing, and runtime validation.
The 7 Best AI Coding Tools for Complex Codebases
The best AI coding tools for complex codebases, ranked on accuracy, suggestion quality, and full-codebase context. See which ones you can actually trust.