Andrew Plowright
Andrew Plowright

Reputation: 587

build_vignettes() randomly failing

The following is contained within a vignette file called test_vignette.Rmd within the vignettes folder of my R library.

---
title: "this is a test"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{this is a test}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

Some test text here

```{r}
print("Text code bubble")
```

To build the package, I run devtools::build_vignettes()

It will sometimes run correctly, but then sometimes it will completely randomly fail:

Building my_package vignettes
--- re-building 'test_vignette.Rmd' using rmarkdown
Warning in file(con, "w") :
  cannot open file 'C:\my_files\my_package\vignettes\test_vignette.R': Invalid argument
Quitting from lines 21-22 (test_vignette.Rmd) 
Error: processing vignette 'test_vignette.Rmd' failed with diagnostics:
cannot open the connection
--- failed re-building 'test_vignette.Rmd'

SUMMARY: processing the following file failed:
  'test_vignette.Rmd'

Error : Vignette re-building failed.
Error: callr subprocess failed: Vignette re-building failed.
Type .Last.error.trace to see where the error occured

I'll try running build_vignettes() and it'll work... then not. It happens randomly about 50% of the time.

Lines 21-22 correspond to the little chunk of R code with print("Text code bubble")

Upvotes: 1

Views: 681

Answers (1)

Paquito
Paquito

Reputation: 31

I am having the same issue here, did you recently upgrade R / knitr ? This may have to do with a recent release https://github.com/yihui/knitr/issues/1899 ?

What is the output of: rmarkdown::render(input = "./vignettes/vignette.Rmd") ?

Upvotes: 2

Related Questions