R 4.0 Running rstan from windows 10, rstan can't recognise file path

Hey! I am new to R. I hope I’m not creating any noise. But I’m really struggling with this.
When I execute rstan, I get following errors:
Error in file(con, “r”) : cannot open the connection
Error in sink(type = “output”) : invalid connection

When I run example(stan_model, package = "rstan", run.dontrun = TRUE) this is what I see: 
..Compilation argument:
 C:/PROGRA~1/R/R-40~1.1/bin/x64/R CMD SHLIB file33882a34876.cpp 2> file33882a34876.cpp.err.txt 
"C:/rtools40/mingw64/bin/"g++  -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.1/include" -DNDEBUG   -I"C:/Program Files/R/R-4.0.1/library/Rcpp/include/"  -I"C:/Program Files/R/R-4.0.1/library/RcppEigen/include/"  -I"C:/Program Files/R/R-4.0.1/library/RcppEigen/include/unsupported"  -I"C:/Program Files/R/R-4.0.1/library/BH/include" -I"C:/Users/Julia Stocker/Documents/R/win-library/4.0/StanHeaders/include/src/"  -I"C:/Users/Julia Stocker/Documents/R/win-library/4.0/StanHeaders/include/"  -I"C:/Users/Julia Stocker/Documents/R/win-library/4.0/rstan/include" -DEIGEN_NO_DEBUG  -D_REENTRANT  -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -include stan/math/prim/mat/fun/Eigen.hpp  -std=c++1y    -march=core2   -include C:/Users/Julia Stocker/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp -I "C:/Users/Julia Stocker/Documents/R/win-library/4.0/StanHeaders/include" -I "C:/Program Files/R/R-4.0.1/library/RcppEigen/include"   -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c file33882a34876.cpp -o file33882a34876.o
g++.exe: error: Stocker/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp: No such file or directory
make: *** [C:/PROGRA~1/R/R-40~1.1/etc/x64/Makeconf:229: file33882a34876.o] Error 1

My session information looks like the following:

R version 4.0.1 (2020-06-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] aida_0.2.1 rstan_2.19.3 StanHeaders_2.21.0-5 bayesplot_1.7.2
[5] tidybayes_2.0.3 brms_2.13.0 Rcpp_1.0.4.6 forcats_0.5.0
[9] stringr_1.4.0 dplyr_1.0.0 purrr_0.3.4 readr_1.3.1
[13] tidyr_1.1.0 tibble_3.0.1 ggplot2_3.3.1 tidyverse_1.3.0

loaded via a namespace (and not attached):
[1] nlme_3.1-148 matrixStats_0.56.0 fs_1.4.1 xts_0.12-0
[5] lubridate_1.7.9 threejs_0.3.3 httr_1.4.1 nimble_0.9.1
[9] tools_4.0.1 backports_1.1.7 R6_2.4.1 DT_0.13
[13] DBI_1.1.0 colorspace_1.4-1 withr_2.2.0 prettyunits_1.1.1
[17] processx_3.4.2 tidyselect_1.1.0 gridExtra_2.3 Brobdingnag_1.2-6
[21] compiler_4.0.1 cli_2.0.2 rvest_0.3.5 arrayhelpers_1.1-0
[25] xml2_1.3.2 shinyjs_1.1 colourpicker_1.0 scales_1.1.1
[29] dygraphs_1.1.1.6 mvtnorm_1.1-1 callr_3.4.3 ggridges_0.5.2
[33] digest_0.6.25 base64enc_0.1-3 pkgconfig_2.0.3 htmltools_0.4.0
[37] dbplyr_1.4.4 fastmap_1.0.1 htmlwidgets_1.5.1 rlang_0.4.6
[41] readxl_1.3.1 rstudioapi_0.11 shiny_1.4.0.2 svUnit_1.0.3
[45] generics_0.0.2 zoo_1.8-8 jsonlite_1.6.1 crosstalk_1.1.0.1
[49] gtools_3.8.2 inline_0.3.15 magrittr_1.5 loo_2.2.0
[53] Matrix_1.2-18 munsell_0.5.0 fansi_0.4.1 abind_1.4-5
[57] lifecycle_0.2.0 stringi_1.4.6 pkgbuild_1.0.8 plyr_1.8.6
[61] grid_4.0.1 blob_1.2.1 parallel_4.0.1 promises_1.1.1
[65] crayon_1.3.4 miniUI_0.1.1.1 lattice_0.20-41 haven_2.3.1
[69] hms_0.5.3 ps_1.3.3 knitr_1.28 pillar_1.4.4
[73] igraph_1.2.5 markdown_1.1 shinystan_2.5.0 stats4_4.0.1
[77] reshape2_1.4.4 rstantools_2.0.0 reprex_0.3.0 glue_1.4.1
[81] RcppParallel_5.0.1 modelr_0.1.8 vctrs_0.3.1 httpuv_1.5.4
[85] cellranger_1.1.0 gtable_0.3.0 assertthat_0.2.1 xfun_0.14
[89] mime_0.9 xtable_1.8-4 broom_0.5.6 coda_0.19-3
[93] later_1.1.0.1 rsconnect_0.8.16 shinythemes_1.1.2 ellipsis_0.3.1
[97] bridgesampling_1.0-0

I don’t have any makevars file. I placed the .Renviron into my home directory.

Sys.which(“make”)
make
“C:\rtools40\usr\bin\make.exe”

These are my directories:
R_HOME C:/PROGRA~1/R/R-40~1.1
R_LIBS_USER C:/Users/Julia Stocker/Documents/R/win-library/4.0
R_USER C:/Users/Julia Stocker/Documents

RTOOLS40_HOME C:\RBuildTools\4.0
PATH …C:\RBuildTools\4.0\usr\bin;C:\RBuildTools\4.0\mingw64\bin;C:\RBuildTools\4.0\mingw32\bin;C:\Program Files\R\R-4.0.1\bin\x64;C:\Program Files\RStudio\bin;C:\Program Files\R\R-4.0.1\bin\i386"

I tried solving the issue by adding library(rstan, lib.loc=“C:\Users\Julia Stocker\Documents\R\win-library\4.0”) each time I call rstans library, however the error still prevails.
I would be very thankful if somebody could help me! I’ve been trying to find a solution for a couple of days now.

You will probably have to install rstan from GitHub to get it to work with StanHeaders_2.21.0-5

remotes::install_github("stan-dev/rstan", subdir = "rstan/rstan", ref = "develop")

Sorry, now I am having trouble downloading from github:

remotes::install_github(“stan-dev/rstan”, ref = “develop”, subdir = “rstan/rstan”)
Downloading GitHub repo stan-dev/rstan@develop
stan-dev-rstan-e634309/StanHeaders/inst/include/libsundials: Can’t create ‘\\?\C:\Users\dja606\AppData\Local\Temp\RtmpULLebl\remotes3048581a439\stan-dev-rstan-e634309\StanHeaders\inst\include\libsundials’
stan-dev-rstan-e634309/StanHeaders/inst/include/src: Can’t create ‘\\?\C:\Users\dja606\AppData\Local\Temp\RtmpULLebl\remotes3048581a439\stan-dev-rstan-e634309\StanHeaders\inst\include\src’
stan-dev-rstan-e634309/StanHeaders/inst/include/stan: Can’t create ‘\\?\C:\Users\dja606\AppData\Local\Temp\RtmpULLebl\remotes3048581a439\stan-dev-rstan-e634309\StanHeaders\inst\include\stan’
tar.exe: Error exit delayed from previous errors.
“C:\PROGRA~1\Git\cmd\git.exe” clone --depth 1 --no-hardlinks --recurse-submodules --branch develop GitHub - stan-dev/stan: Stan development repository. The master branch contains the current release. The develop branch contains the latest stable development. See the Developer Process Wiki for details. C:\Users\dja606\AppData\Local\Temp\RtmpULLebl\remotes3048581a439/stan-dev-rstan-e634309/rstan/rstan/…/…/StanHeaders/inst/include/upstream
Error: Failed to install ‘rstan’ from GitHub:
Command failed (128)
In addition: Warning messages:
1: In utils::untar(tarfile, …) :
‘tar.exe -xf “C:\Users\dja606\AppData\Local\Temp\RtmpULLebl\file304833aa1e6b.tar.gz” -C “C:/Users/dja606/AppData/Local/Temp/RtmpULLebl/remotes3048581a439”’ returned error code 1
2: In system(full, intern = TRUE, ignore.stderr = quiet) :
running command ‘“C:\PROGRA~1\Git\cmd\git.exe” clone --depth 1 --no-hardlinks --recurse-submodules --branch develop GitHub - stan-dev/stan: Stan development repository. The master branch contains the current release. The develop branch contains the latest stable development. See the Developer Process Wiki for details. C:\Users\dja606\AppData\Local\Temp\RtmpULLebl\remotes3048581a439/stan-dev-rstan-e634309/rstan/rstan/…/…/StanHeaders/inst/include/upstream’ had status 128