GitHub Actions: npm cache does not fix an error after changing lockfile
After changing package-lock.json CI continues to report dependency errors, and diagnostics focus on cache. Cache speeds up the download of packages, but does not replace the correct lockfile or Node version compatibility.
How to determine the source of the error
Check the cache key and have a lockfile actually changed after the dependency update.
Run e.g., analyze the first actual installation error and Node runner version.
What to do step by step
1. Fix inconsistent package.json/package-lock and do not rely on random node modules content.
2 . If cache is damaged, void it consciously and let you restore correct dependencies.
How to check the score
Clean runner installs packages and passes tests independently of local node modules directory.
What to do
Do not remove lockfile blindly to create a random version set.