Stuck at setup chunk when trying to run anything on a Rmarkdown file

Exactly the same issue as in this entry, which was never solved: R markdown chunk will not run

Just installed R, Rtools and RStudio to my new work computer and I encountered this error, where I can run code in the console or in an R script without any issue, but whenever I try to run any code anywhere in an Rmarkdown file, RStudio tries to run the setup chunk at the beginning of the file and seems to get stuck there, never getting past it, either displaying the "stop running" sign or the "waiting to run" sign (as shown in the link above).

Surprisingly, knitting the Rmarkdown file works without any issue. I have fully uninstalled R, Rtools and RStudio as indicated in How to uninstall R and RStudio with all packages, settings and everything else? - Stack Overflow, and re-installed them, and still have the same error.

I'm working on a Windows 10 machine, with R version 4.4.2 (2024-10-31 ucrt) and RStudio Version 2024.12.0+467.

Would appreciate any help on how to fix it.

Thanks for reading!