How do you share node_modules across CI stages in an Nx monorepo without Nx Cloud?
Hi everyone,
I'm currently working as an intern, and one of my tasks is to rebuild/improve our frontend CI/CD pipeline.
We are using an Nx monorepo, and as many of you probably know, caching can become a real bottleneck.
The main issue is with node_modules, which is around ~3 GB. Right now, every stage/job in the pipeline has to download the cache again, and since we have 8 jobs, this adds a huge overhead.
I’m trying to figure out if anyone has already faced this kind of problem and found an efficient solution without using Nx Cloud.
More specifically:
- How do you handle sharing such a large node_modules dependency between stages/jobs?
- Is there a better approach than forcing each job to restore the same cache?
- Do you use artifacts, Docker layers, custom images, or another workaround?
I’d really appreciate any feedback, best practices, or real-world experiences.
Thanks!