GitHub Actions setup-node cache "path glob not matched"
When cache is enabled on setup-node, it hashes the package manager lockfile to build the cache key. If no lockfile is found at the default location (or the configured cache-dependency-path), it cannot resolve a path to cache.
What this error means
A setup-node step with cache fails saying no paths matched, or that the dependencies lockfile was not found, in a monorepo or non-root project.
Error: Some specified paths were not resolved, unable to cache dependencies.
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 not at the repo root
In a monorepo or subdirectory project the lockfile is not where setup-node looks by default.
Wrong package manager for cache
cache: npm with only a pnpm-lock.yaml (or vice versa) finds no matching lockfile.
How to fix it
Point cache at the real lockfile
- Set cache-dependency-path to the lockfile location (supports globs for monorepos).
- Match the cache value to the package manager that produced the lockfile.
- Ensure the lockfile is committed.
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
cache-dependency-path: 'apps/web/pnpm-lock.yaml'How to prevent it
- Set cache-dependency-path explicitly in monorepos.
- Keep the cache type aligned with the committed lockfile.