People have tried to stop lava from flowing. This is why they failed
https://edition-m.cnn.com/2018/05/08/us/hawaii-roads-volcano-lava/index.html
If we predict how much heat energy is generated during eruption, it's possible to prepare for it by calculating how much coolant is needed.
But, as far as the current technology can cover, it's impossible to take measures for volcano eruption.
What we can do is just to evacuate to safer place. So, it's important to simulate evacuation routes before disaster happens.