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

2 Likes

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)
2 Likes

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)
dir.create("inst/doc")
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.

1 Like

Has this issue been resolved? I've been running into the same issue.

I'm new to package development so I've been following the Wickham and Bryan book to the letter. Initially, after writing the vignette, I would run a check via the RStudio check button. After that finished without error or warning, I would run devtools::build(vignettes = TRUE) then click the RStudio "Install and Restart" button. I can see the vignette folder in the package directory, including the .html and .Rmd files for the vignette. Sadly, after this ran, I still was unable to find my vignette with browseVignettes(...) or vignette(...).

After seeing many related issues on various discussion boards, I tried a few fixes. I tried updating the Description file's Suggest and VignetteBuilder sections with rmarkdown, kritr while changing the vignette header to %\VignetteEngine{rmarkdown::render}. No avail. I tried running devtools::build_vignettes(...). Now there is a 'doc' directory that contains a built vignette in html form (mimicking the actual vignette folder) but browseVignette(...) can't find the vignette. I tried configuring the build tools in RStudio to roxygenize every time the package is build and to use roxygen to build vignettes, no luck.

I'm at a loss here, and this seems to be a common problem (another open issue here ). I'm incredibly grateful for the Wickham and Bryan book, as well as the Yihui book, on this topic. However, I'm hoping the RStudio team can provide some guidance here, the referenced github board, or better yet, a blog post on best practices in Vignette development workflow.

1 Like

I am having the same issue. The main reason I am trying to access the vignette is so that I can link it to another package that I have built at work. I am looking to build a get started documentation with links to vignettes that I have already built so that I don't have 2 documents to update every time I make a change.

Love pkgdown! Use it at work for all my documentation.

I am only another user of this forum, but wrote a blog post about vignettes.

  • I think pkgdown websites are the best way to browse vignettes. :speak_no_evil: If a pkgdown website is public, and its configuration + DESCRIPTION indicate its URL, then in another package pk2 docs you can use vignette("blabla", package = "pkg1") and this will be linked, in the pkgdown website of pkg2, to the vignette page in the pkgdown website of pkg1. See pkgdown auto-linking vignette.

  • To build vignettes for a local package I'd use e.g. remotes::install_local(build_vignettes = TRUE). Then using browseVignettes() works.

  • In the R Packages book, it is written that devtools::build_vignette() is rarely useful.

Hope this helps!

Why I don't use

remotes::install_local(build_vignettes = TRUE)

This does not create the inst/doc folder and I want that on GitHub so that users do not have to rebuild the vignettes when installing. If the inst/doc folder is complete (has all the completed vignettes and anything else I want there, then either of these commands will install the package with the vignettes intact.

devtools::install_github("username/pkg")
remotes::install_github("username/pkg")

I could of course tell users to use

remotes::install_github("username/pkg", build_vignettes = TRUE)

but users are familar with the usual install_github command and I don't want them to have to add build_vignettes. I just want it work as normal (like a CRAN install) in regards to vignettes.

3 Likes

@e2holmes this makes sense!

To create a more CRAN-like experience for users you might want to check out R-universe.

@e2holmes: this is incredibly valuable information that I couldn't find anywhere else on working with vignettes and github. I tried everything and still saw no vignettes, and I thought I was going crazy! This solution is a great fix for those of us who want github installs (and the devtools/RStudio workflow) to work the way that I expected they would before I ran into this issue.

Glad it is useful! If you want your doc folder on GitHub, be aware that using check from RStudio build panel is going to wipe out the doc folder. Two answers above, I show my workflow to stop devtools:check() from wiping out the doc folder as you prep your R package to upload to GitHub.