Skip to content

Commit ca16e0b

Browse files
zkamvarfmichonneau
authored andcommitted
set CRAN url if default is "@cran@"
This will fix #526
1 parent c4b6e23 commit ca16e0b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

bin/dependencies.R

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ install_required_packages <- function(lib = NULL, repos = getOption("repos", def
99
c("rprojroot", "desc", "remotes", "renv"),
1010
rownames(installed.packages(lib.loc = lib))
1111
)
12+
# The default installation of R will have "@CRAN@" as the default repository, which directs contrib.url() to either
13+
# force the user to choose a mirror if interactive or fail if not. Since we are not interactve, we need to force the
14+
# mirror here.
15+
if ("@CRAN@" %in% repos) {
16+
repos <- c(CRAN = "https://cran.rstudio.com/")
17+
}
1218

1319
install.packages(missing_pkgs, lib = lib, repos = repos)
1420

0 commit comments

Comments
 (0)