Use built-in npm cache support.

Section: Caching dependencies

Cache npm dependencies with setup-node

yaml
yaml
- uses: actions/setup-node@v4
  with:
    node-version: 20
    cache: npm
Explanation

Prefer first-party built-in caching support when available.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Caching dependencies
Cache arbitrary paths
Use `actions/cache` for custom cache paths.
OpenIn sheetyamlsame section
Upload build output as an artifact
Save files from the workflow run for later download or later jobs.
Download a prior artifact
Fetch an artifact in a later job.
List workflows with GitHub CLI
Inspect workflows from the terminal.
Trigger a workflow manually with gh
Dispatch a workflow file from the CLI.
Watch a workflow run
Stream progress of the latest run in the terminal.