Problems installing cmdstan on Windows 11

I am running R 4.2.2 on a Windows 11 Machine. I am trying to follow along with the cmdstanr and cmdstan installation instructions but can’t seem to get cmdstan to install.

I successfully installed cmdstanr into my renv project environment. Now, according to the documentation, I need to install cmdstan.

When I do so, I recieve the following error:

> install_cmdstan( cores = 4, overwrite = T)
The C++ toolchain required for CmdStan is setup properly!
* Latest CmdStan release is v2.31.0
* Installing CmdStan v2.31.0 in C:\Users\damon\Documents/.cmdstan/cmdstan-2.31.0
* Downloading cmdstan-2.31.0.tar.gz from GitHub...
* Removing the existing installation of CmdStan...
* Download complete
* Unpacking archive...
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\damon\Documents/.cmdstan/cmdstan-2.31.0/make/local': No such file or directory

I have RTools42 installed and have gone to my control panel to set my system path variable to include: C:\rtools42\usr\bin and C:\rtools42\mingw64\bin as discussed here. I also tried running an example model as suggested here, but recieve the following error:

> fit <- cmdstanr_example("logistic")
Compiling Stan program...
Error in `(function (command = NULL, args = character(), error_on_status = TRUE, …`:
! System command 'make' failed
Exit status: 2
make: *** No rule to make target 'print-STANCFLAGS'.  Stop.
Type .Last.error to see the more details.

I’ve also checked out this blog post that folks seem to reference, but still can’t seem to get things to work.

This has been challenging me all morning…

I guess I shouldn’t use renv to install cmdstanr. I just installed it on my system instead and it worked.