"Could not locate an R installation on the system" error

I've downloaded R and RStudio about 5 times now and keep getting this error. I've looked all over and none of the recommended solutions work. This is the error I keep getting.

Screenshot 2023-01-24 162722

If you are using miniconda3 or anaconda Evirnoments run conda deactivate base before run R on the command line.