It is not possible to prevent volcanoes from erupting. If people correctly predict a volcanic eruption, it is possible to keep the resulting damage to a relatively limited level.
Volcano experts, known as volcanologists, know how to detect the warning signs a volcano exhibits when it starts to become active. At that point, the volcanologists can monitor the activity of the volcano and prepare for the eruption. The relevant government agencies and experts can then create a detailed plan that allows for the proper evacuation of people who are at risk. The plan for dealing with an eruption also includes the gathering of an emergency supply of food and other basic provisions.