Error when using Travis-CI and testthat

I am trying to use Travis CI with an R package:

  • The package on GitHub is here)

*The Travis CI page for the package is here

I used usethis::use_travis() to set up the package for use with Travis CI.

When I make any update to the files in the repository, I get the following message on Travis CI:

Error: processing vignette 'comparing-mclust-and-mplus-output.Rmd' failed with diagnostics:
'roxygen2' >= 5.0.0 must be installed for this functionality.
Execution halted

I checked the version of roxygen2 that I have, and it is 6.0.1.

I posted a very similar question on Stack Overflow and someone commented with one other similar issue.

Any ideas or directions for what am I missing or otherwise doing incorrectly in using Travis CI? Thank you!

I responded to your post on SO. It seems that roxygen2 is not installed when the build is running on Travis, so it might be worth adding roxygen2 to your list of "Suggests" packages in your DESCRIPTION file

1 Like

The underlying issue here is really that you are calling devtools::load_all() in your vignettes and by load_all() needs roxygen2 to work, which is where this error is coming from.

I would suggest changing theses chunks to eval = FALSE or removing them entirely, the development version of all your package is installed before building vignettes so there is no need for load_all() there.

You can also remove devtools and roxygen2 from Suggests after doing this.

1 Like

Thanks. The reason I included those was that I wanted to be able to build the vignettes locally after making changes to the source code (to make sure they worked correctly) without installing the package again (since this package is not yet on CRAN, via devtools::install_github(). As you saw, I included devtools::load_all() but set the chunk to not be echoed, whereas the chunk with library() I set to not be eval-uated.

This is now a separate question, but is there a way to be able load the most recent version of the package besides re-installing the package (either via GitHub or from a local version of the package) or using devtools_load_all()? Thanks again.

I wrestled with this recently as an avid devtools::load_all() user. I'm curious what others have to say, but as far as building vignettes with devtools::build_vignettes, it seems that you generally need to have the package installed. As a result, the simplest approach I have seen is to use the Install and Restart button in RStudio.

image

It installs the package locally, so it does not get around your options you want to avoid. The other alternative is to just knit/render vignettes interactively as you build them. You can also use pkgdown and connect it to Travis so every travis build produces an accessible version of the vignettes on netlify or something like that.

1 Like