Skip to content
Latchkey

actions/setup-node: Versions, Caching & Fixes

setup-node installs the Node version you ask for and can cache your package manager for you.

Prefer setup-node’s built-in caching over a manual actions/cache step - it is simpler and correct by default.

Usage

.github/workflows/ci.yml
- uses: actions/setup-node@v4
  with:
    node-version: 20
    cache: npm   # or yarn / pnpm

Notes

  • node-version-file: .nvmrc reads the version from your repo.
  • cache needs a lockfile present to work.
  • Version-not-found → check the version exists and the spec is valid.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →