How do we clear the cache on branch deploys? It’s possible on the master branch but not on other branches.
Also is it possible to clear the cache without doing a deploy?
We’re constantly having to clear the cache as we have our a private package repo on npm. Whenever we push changes to our own packages the deploy never picks them up unless we clear the cache first. Is this supposed to happen?
Thanks for getting back to me. We already update the package version automatically as we’re updating dependencies, unfortunately Netlify doesn’t install the latest version unless we clear the cache. Is this a bug on your end?
Number 4 might be a bit of a workaround for now, we could use an environment variable to run a script to remove the cache. What is the path to the Netlify cache though? I assume it’s the same as the local cache e.g /node_modules/.cache?
@gilesbutler, Netlify stores certain files in /opt/build/cache and reloads them each build to prevent downloading files more than once if we have copies already.
Note, the build runs in /opt/build/repo by default. Below is a copy of the command ls -alh ../cache which was run during a build of one of my Netlify sites:
Hopefully, this gives an overview of where to find the Netlify build cache and the types of files/directories which are stored there. To summarize, this cache located at ../cache relative to the base of the cloned repo (which is the default build directory).
Please let us know if there are other questions about this.
The problem is as stated in Cache issue on Netlify? - #3 by glorifiedmonkey that everything seems to be working fine, except for the live url, where the old version of the page is still deployed.
Since I deploy using CLI (no Github - Netlify integration), I also can’t "clear cache and deploy).
I read the thread above and I see some hints towards a “.cache” directory in the root folder, where netlify commands are run. However, I don’t have such a directory (I made sure to use “ls -alh” to see hidden files and folders). I have a .cache directory in node_modules, but nothing in connection with netlify deploys.
How can I purge cache before deploying to production, and isn’t this simply a bug when after deploying to production everything’s fine on the preview url, everything’s fine on the unique deploy url but the old version is on the live url? Seems like a bug to me…
The problem “solved itself”. The cache must have been invalidated now in the meantime. That means, this issue is no longer reproducible for now. If someone would still like to investigate, I can make another change…
Hi, @glorifiedmonkey, the build cache and the cache for the CDN nodes are two different things.
It sounds like the issue you saw was with out of date content on the CDN, not in the build system. I just want to be clear which cache you are referring to and this topic is about a cache you aren’t using (as far as I can tell).
To keep things clear, I’ll no longer reply to this topic and follow-up in the first topic where this was commented about here.
I am having an issue where each new branch deploy that is created (from new PRs) is running against a stale cache. How do I tell Netlify to reset the base cache that used to prime the cache for a new branch deploy?