Fetching NEXT.js cache very slow


I am have project using NX with an api in Nest.js and the front-end in Next’s. The nest app builds in a couple of minutes but NextJS is taking over 20 min to deploy now. Looking at logs, it seems loading the cache takes most of the time.

12:00:24 PM: Fetching cached dependencies

12:00:24 PM: Starting to download cache of 35.2GB

12:09:06 PM: Finished downloading cache in 8m41.436s

12:09:06 PM: Starting to extract cache

12:13:24 PM: Finished extracting cache in 4m18.526s

12:13:25 PM: Finished fetching cache in 13m0.556s

The actual build is around 6 - 8 min. Kind of defeats the caching idea when actually installing most of dependencies is faster than fetching the cache. Anything I can do to make this faster or improve?


You’ve 35 GB of cache, so I won’t call this “slow”. You can:

  1. Check if your repo has a big commit history or size. Larger repos would take up a lot more space.
  2. Check you dependency size.
  3. Just clear your cache once - it can accumulate over time if you never had a build free from cache.

If none of those apply, there’s basically nothing we can do about it. 35 GB cache is a large size for a web project.