Best way to avoid reinstalling dependencies in CI (multiple machines)

Hello there.

I am having problems trying to set up our ci config even though I have read many threads about it.
My problem:
Since we have 2 machines with 2 runners each, we cant really use cache to store the dependencies for the jobs.

What should we do?
We have thought about reducing the number of runners to 2, so we can use only 1 machine and then be able to reuse the cache. Is that worth it?
I am trying to set a gitlab ci settings to check if node_modules does not exist in cache and then execute install again.

Honestly i cant find a proper solution but our goal is to avoid reinstalling and wasting 8/10 minutes every time we run a job.

Sorry if I explained poorly, I still dont understand Gitlab in depth.

Thanks in advance.

Hi,

distributed cache is your only option