GitHub Actions "Dependencies lock file is not found" (setup-node cache)
setup-node's built-in cache keys on a lockfile. If no package-lock.json, yarn.lock, or pnpm-lock.yaml is found at the expected path, it cannot compute the cache key and fails.
What this error means
The setup-node step fails with "Dependencies lock file is not found" listing the patterns it searched, usually when the lockfile lives in a subdirectory or was not committed.
github-actions
Error: Dependencies lock file is not found in /home/runner/work/repo/repo. Supported file patterns: package-lock.json, npm-shrinkwrap.json, yarn.lockCommon causes
Lockfile in a subdirectory
The project lives in a subfolder (monorepo package), but the cache search runs from the repo root and finds no lockfile there.
Lockfile not committed
package-lock.json / yarn.lock is gitignored or never committed, so checkout produces a tree with no lockfile to key on.
How to fix it
Point the cache at the real lockfile
- Set cache-dependency-path to the lockfile location.
- Commit the lockfile so it is present after checkout.
- For monorepos, pass the subdirectory path or a glob.
.github/workflows/ci.yml
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: packages/app/package-lock.jsonHow to prevent it
- Commit lockfiles and keep them out of .gitignore.
- Set cache-dependency-path for non-root projects.
- Run checkout before setup-node so the lockfile exists.
Related guides
GitHub Actions setup-node cache "Some specified paths were not resolved"Fix the GitHub Actions setup-node cache warning "Some specified paths were not resolved, unable to cache depe…
GitHub Actions hashFiles Returns Empty - Cache Key Has No HashFix GitHub Actions hashFiles() returning an empty string - the glob matched no files, so the cache key collap…
GitHub Actions "Path Validation Error" / Cache Path Does Not ExistFix actions/cache path errors - a path missing at save time, or a mismatch between save and restore paths, so…