Config with Cache Enabled

steps:
  - uses: actions/checkout@v4
  - uses: actions/setup-node@v4
    with:
      node-version: '22'
      cache: 'npm'      # This is all you need
  - run: npm ci
  - run: npm run build

npm install vs npm ci

npm installnpm ci
SpeedNormalFaster
package-lock.jsonMay update itNever updates it
Use caseDevelopmentCI/CD

Common Pitfalls

  • Adding cache: 'npm' is all it takes — no extra configuration needed
  • Cache is invalidated when package-lock.json changes

For the overall workflow structure, see GitHub Actions: Basic Auto-Deploy Setup.

  • Fiverr - Find freelance developers and tech experts