'There is a cache miss
I'm trying to cache the cypress installation in my build pipeline.
I have this task setup:
- task: Cache@2
inputs:
key: 'cypress | $(Agent.OS) | package-lock.json'
path: 'C:\npm\prefix\node_modules\cypress'
I've run the build pipeline multiple times but I'm always getting the same error:
There is a cache miss
This is the previous build:
As you can see it's the same fingerprint, so why is the caching not working?
Solution 1:[1]
Set variable
system.debug
totrue
to get more information.You would check the path to see whether it is correct on the agent machine (you are using self-hosted agent, correct?)
Usually, on the first run after the task is added, the cache step will report a "cache miss" since the cache identified by this key does not exist. As you always got "cache miss" issue, I suspect the cache is not created or uploaded correctly. You may try to do some modification for
package-lock.json
to recache and re-generated one new key, to see how's the result.
Solution 2:[2]
Check the "cache post-job task" results and see if the keys are different.
In my case I had to use npm install --no-save
so that the package-lock.json file wasn't regenerated during the pipeline. This ensured the "cache post-job task" was using the same cache key when caching node_modules.
Solution 3:[3]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Cece Dong - MSFT |
Solution 2 | Peter |
Solution 3 | kqly |