Might be due to your setup. The officially recommended minimum RAM capacity for UE 5 is 32GB. You can still work with 16GB for smaller scale projects, but even in that case adding VS onto it isn’t really ideal. Btw I did use UE 5 with VS when I had 16GB of RAM, there’re no issues with that, just came up with possible explanations for your current issue. Maybe you’re good on that aspect even, and it’s just a random thing.
Anyways, try closing the editor and building it from VS the way I explained.
Let us know how it goes