Error installing cmdstan

I’m struggling with the cmd installations. The system I’m using is Windows 10. Below is the error messages I got. Could someone help me with that?

Compiling Stan program...
Error: CmdStan path has not been set yet. See ?set_cmdstan_path.
> install_cmdstan()
RTools installation found but PATH was not properly set.
Run check_cmdstan_toolchain(fix = TRUE) to fix the issue.
> check_cmdstan_toolchain(fix = TRUE)
Installing mingw32-make and writing RTools path to ~/.Renviron ...
Error in file(file, ifelse(append, "a", "w")) : 
  cannot open the connection
In addition: Warning message:
In file(file, ifelse(append, "a", "w")) :
  cannot open file 'C:/Users/yueho/OneDrive/??/.Renviron': Invalid argument ```


Hi @hy2022, the error says you haven’t set rtools path in your environment, you may want to follow this guide Installing CmdStanR on Windows - Max's Blog which helped me a lot when I switched from rstan to cmdstanr. This post may also help you a bit Error when installing CmdStan in Rstudio. The installation of the cmdstanr on Windows is pretty smooth now.