browseVignettes(mypackage) saying no vignettes found

I have tried using devtools::build_vignettes() and just devtools::build() . Particularly, when using devtools::build_vignettes(), I get output to the console saying

--- re-building 'vignette.Rmd' using rmarkdown
--- finished re-building 'vignette.Rmd'

for each of my vignettes, but then afterwards I get a message saying moving all my .html and .R files generated by my .Rmd vignettes to doc/ directory, and then another message saying all my .Rmd files are being copied to my doc/ directory. Finally, I get one more message saying

Building vignette index

However, when I try to browseVignettes("My_Package") I get an error saying no vignettes found. This is a package I have been working on for a while and I've never previously had this issue. Please help.

Additional information: This is a package designed for local use within a company, not for upload to github. So when I build I am building a source package and installing it using remotes::install_local(). Not sure if this is relevant because the issue has never occurred before when developing this package as such previously, but nonetheless might be worth the mention

Maybe you updated remotes in the meantime? In any case this post about devtools/remotes behavior by @cderv might help. Untested:

remotes::install_local(..., build = TRUE, build_opts = c("--no-resave-data", "--no-manual")
1 Like

I think it is just that by default this function does not build the vignette. See ?remotes::install_local()
There is a build_vignettes argument you need to set to TRUE for the vignette to being build in the installation process.

remotes::install_local(..., build_vignettes = TRUE)

But even when I'm inside the project folder for developing the package I still get the issue, before I've even compiled the package as a source package. Sometimes the vignette index will load, but when I click on a specific vignette it says "No docs found for package MyPackage"

How do you build the package locally during development ?
Here some useful ressource :

1 Like

I always have this same vignette problem when I am building packages on RStudio that I host on GitHub. The reason is that in that situation I want the vignettes files in the inst/doc folder. If you build to a .tar.gz (which is what you'd upload to CRAN), then the vignettes files are put there, but if you build and install using Install and Restart on RStudio's build tab, then the files won't be in the inst/doc folder even if you have specified for Roxygen to rebuild your vignettes on Install and Restart. It rebuilds them in the vignettes folder but doesn't copy them to inst/doc.

Here is my workflow.

  • Prepare my vignette Rmds in the vignettes folder. Use the template in RStudio.
  • Use this code to build them and put them in the inst folder.
tools::buildVignettes(dir = ".", tangle=TRUE)
file.copy(dir("vignettes", full.names=TRUE), "inst/doc", overwrite=TRUE)
  • Then push the changes to GitHub. Also this will mean that when you use Install and Restart on the Build tab, your vignettes will now be there too (e.g. they'll show up on browseVignettes().

Be aware that RStudio's default Check package behavior on the Build tab is to delete your inst/doc folder. If you don't notice and push changes to GitHub, you've just deleted all your vignettes from your GitHub package. They are still there in the vignettes folder but you'd have to use the build_vignettes=TRUE in install_github() to see them. The deletion is happening because you need to use devtools:check(".", vignettes=FALSE) and there is no way to set that from the Build Options in RStudio. But you can uncheck the use devtools package functions and stop RStudio from using devtools. You may want to add --no-manual to the R CMD check options box since building the manual can be time consuming.

Note the devtools functions are not helpful, I find, since they are for a different workflow more oriented to submitting packages to CRAN via a .tar.gz file or if you are not working via the RStudio build platform.

devtools::build_vignettes() is going to rebuild your vignettes but put them at the base level in doc which is not where you need them. It will also create the Meta folder which you don't need.

devtools::build() will make a tar.gz file with the vignette files in inst/doc but you don't want the tar.gz for your GitHub package repo or for the Install and Restart button on the Build tab. You want the inst/doc folder filled with the vignette files.