Rstan throwing error on Windows 10

Operating System: Windows 10
Interface Version: R Version 3.5.3, Rstudio 1.2.5

Running any stan fit including the demos on the Getting Started with STAN page produces this error after pulling up the window to install rtools even though they are already installed:

Error in system(cmd, intern = !verbose) :
‘C:/PROGRA~1/MIE74D~1/R’ not found
Error in sink(type = “output”) : invalid connection

Do

example(stan_model, package = "rstan", run.dontrun = TRUE)

and post all the output after the line that says Compilation argument:.

Thank you for helping. Here is the output:

Compilation argument:
C:/PROGRA~1/MIE74D~1/R Open/R-3.5.3/bin/x64/R CMD SHLIB file2e7d84a563fec.cpp 2> file2e7d84a563fec.cpp.err.txt
Error in file(con, “r”) : cannot open the connection
In addition: Warning message:
In file(con, “r”) :
cannot open file ‘file2e7d84a563fec.cpp.err.txt’: No such file or directory

What is packageVersion("rstan")?

Thank you for you help. The package version result is:

‘2.19.2’

What is

pkgbuild::has_build_tools(debug = TRUE)

?

This will try to install rtools with the dialog box even though they are already installed. When i say no, it comes up again and then it registers false. When i run find rtools it does find them.

And

example("cxxfunction", package = "inline", run.dontrun = TRUE)

?

cxxfnc> # default plugin
cxxfnc> fx <- cxxfunction( signature(x = “integer”, y = “numeric” ) , ’
cxxfnc+ return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ;
cxxfnc+ ’ )
Error in system(cmd, intern = !verbose) :
‘C:/PROGRA~1/MIE74D~1/R’ not found

I am beginning to think this is a problem with my machine’s security more than anything else. I spun up an azure machine and everything works fine.

I think it has more to do with using Microsoft R, which it is saying it cannot find.