In our Bitbucket pipeline, we are caching the node modules.
caches:
- node
We are doing this to make sure we don't download the node modules if it is already present in the cache.
But when there is a change in the package.json dependency (added a new npm package and used in the components), we are expecting the pipeline to re-fetch the node modules instead of taking it from the cache.
What happens currently is: when there is a cache for node modules exists in pipeline irrespective of the current status of package.json, the node cache is being used. Ideally, node modules has to be refreshed in refernce to the package.json
So, the pipeline fails. When we delete the node cache manually and re-run the same pipeline, it gets succeeded.
Thanks in advance for your help.