The crowd of demonstrators outside in Glastonbury, Somerset, held up banners reading “Fossil Fuels Are Killing The Planet” and “Tory Policy KiIl“, while a lone guitarist sang “The Boris Blues”.
It has been reported the prime minister was advised by the police to abandon the visit on security grounds.
He was forced to divert to a bakery in nearby Wells, where he told customers: “There were lots of crusties there – more crusty than your loaves.”
The incident came a day after Mr Johnson came under fire from flood victims in face-to-face meetings in Yorkshire, over his government’s slow response to the crisis there.
One protester, who did not give his name, said of Mr Johnson’s change of plans: “It doesn’t surprise me, if you look at the 10 Tories that are here to welcome him compared to 150 people [protesting] here.
“He has got no clue what any of these people feel and what their daily experiences are like. It’s not surprising he may not turn up.”
Later, in Wells, the prime minister faced further criticism for serving sausage rolls and pasties to customers – although he was cheered and welcomed by others.
Lynnsey Kelly, who runs a flower shop in the city, said: “Right at this very moment in time, are there not more important things to be done in this country than the prime minister coming to somewhere like Wells and serving pasties to people and having a photo opportunity? It is absolutely disgusting.”
The prime minister then went on a short walkabout in Wells High Street, where he was cheered and welcomed by several people although there was some heckling from a handful of others.
He also visited a card shop, where he was presented with a card featuring a bulldog with a mop of blond hair located in Downing Street.
On Wednesday, Mr Johnson refused to apologise in the flooding row, insisting that a “huge amount of work” is going on to help and compensate victims.
He was criticised over whether enough has been spent on flood defences in deluged regions of Yorkshire, the east Midlands and Lincolnshire.
Asked to apologise and challenged over why voters in the areas under water should support him, Mr Johnson claimed the government had already put £2.6bn into defences and was exploring longer term solutions such as “planting more trees”.