Requirement for VS19 when updating to 5.1

I am trying to update my project from 5.0 to 5.1, but when I open the project in 5.1 it says

To open this project you must first install Visual Studio 2019.

Would you like to download and install it now?

I have tried selecting both VS Code and VS22 as an IDE but still nothing. I tried pressing ok on the prompt and it just freezes Unreal without downloading anything (checked using task manager).

Any ideas for solutions?