Deployment of pages with R-travis fails with pkgdown when vignettes includes the current package


I am trying to deploy on gh-pages with pkgdown, using the following code in .travis.yml

  - covr
  - pkgdown

  - Rscript -e 'pkgdown::build_site()'
   - provider: pages
     skip-cleanup: true
     github-token: $GITHUB_TOKEN
     local_dir: "docs"
      keep-history: true
       branch: master

The result of the Travis build shows that everything works fine until the call to build_article()

── Building articles 
Writing 'articles/index.html'
Reading 'vignettes/Import_data.Rmd'
Error in library(PLNmodels) : there is no package called 'PLNmodels'

Indeed, I need to load my own package in the vignette Import_data.Rmd : did I miss something in the Travis or pkgdown config ?

Note that the page build process works fine locally when I call the pkgdown::build_site() function.

Any idea ? @jimhester or @jeroen


The travis scripts build and check your package, but they do not install it. You can do this yourself, though. This should work:

  - Rscript -e 'devtools::install()'
  - Rscript -e 'pkgdown::build_site()'

Thanks, it works, indeed. In fact, I used

        - R CMD INSTALL .
        - Rscript -e 'pkgdown::build_site()'

Any reason for preferring Rscript -e 'devtools::install()' ?

1 Like

That code was adapted from what I am actually using, which looks more like:

  provider: script
  script: Rscript -e 'devtools::install(); pkgdown::deploy_site_github()'
  skip_cleanup: true

In the deploy step you cannot use multiple commands. A shell script seemed to much and the above form looks nicer to me than R CMD INSTALL . && Rscript -e 'pkgdown::deploy_site_github()'.