My guess is these R packages are being installed to the wrong directory. Maybe try
stopifnot(nchar(Sys.getenv("R_LIBS_USER")) > 0)
dir.create(Sys.getenv("R_LIBS_USER"), showWarnings = FALSE, recursive = TRUE)
install.packages("rstan", repos = "http://cloud.r-project.org",
lib = Sys.getenv("R_LIBS_USER"))