Search code examples
rtravis-cirscript

In travis.ci Rscript seems to be ignoring the .Reviron file


In travis, I am creating a Renviron file with the following line:

options(repos = c(CRAN="http://cran.rstudio.com",DRAT="http://sahilseth.github.io/drat")

This adds two repositories CRAN (official R repo) and my personal repo.

This works perfectly on my own computer, but on travis, R seems to ignore the .Rprofile file.

Here is a block from travis output (https://travis-ci.org/sahilseth/flowr/builds/84850698)

echo 'options(repos = c(CRAN="http://cran.rstudio.com",DRAT="http://sahilseth.github.io/drat")' > .Rprofile
Rscript -e 'options("repos");print(.libPaths())'

Output:

$repos
    CRAN 
"@CRAN@" 
[1] "/home/travis/Rlib"             "/usr/local/lib/R/site-library"
[3] "/usr/lib/R/site-library"       "/usr/lib/R/library"           

Running the same on the PC shows:

$repos
                 CRAN
"http://cran.rstudio.com"
                 DRAT
"http://sahilseth.github.io/drat

Solution

  • You're missing a closing parenthesis in the line you use to create .Rprofile:

    echo 'options(repos = c(CRAN="http://cran.rstudio.com", 
                            DRAT="http://sahilseth.github.io/drat"))' > .Rprofile