From ca16e0be7110e18c1cef47544698141fefdb53af Mon Sep 17 00:00:00 2001 From: "Zhian N. Kamvar" Date: Wed, 2 Dec 2020 09:35:13 -0800 Subject: [PATCH] set CRAN url if default is "@CRAN@" This will fix #526 --- bin/dependencies.R | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/dependencies.R b/bin/dependencies.R index ad5afe7..640b3e2 100644 --- a/bin/dependencies.R +++ b/bin/dependencies.R @@ -9,6 +9,12 @@ install_required_packages <- function(lib = NULL, repos = getOption("repos", def c("rprojroot", "desc", "remotes", "renv"), rownames(installed.packages(lib.loc = lib)) ) + # The default installation of R will have "@CRAN@" as the default repository, which directs contrib.url() to either + # force the user to choose a mirror if interactive or fail if not. Since we are not interactve, we need to force the + # mirror here. + if ("@CRAN@" %in% repos) { + repos <- c(CRAN = "https://cran.rstudio.com/") + } install.packages(missing_pkgs, lib = lib, repos = repos) -- 2.30.2