rstudio / packrat

Packrat is a dependency management system for R
http://rstudio.github.io/packrat/
401 stars 89 forks source link

HTML/extras created on-disk during file-dependency probing #644

Closed aronatkins closed 2 years ago

aronatkins commented 2 years ago
  1. Create a new directory/project.

  2. Populate that directory

    bookdown::create_bs4_book(".")
  3. Add a code-block to index.Rmd so package dependencies are discovered.

    ```{r, include = FALSE}
    library(downlit)
    library(bslib)
    library(xml2)
  4. Render that book locally.

    rmarkdown::render_site(".")
  5. Attempt to deploy that directory.

    rsconnect::deploySite(
        siteDir = ".", 
        siteName = "BOOK-TITLE", 
        account = "ACCOUNT_NAME", 
        server = "SERVER_NAME", 
        render = "server")

The deployed bundle contains a libs directory and *.html files that were created as a side-effect of running the packrat snapshot against the directory. These files cause downstream rendering problems.

These files are created by the call to rmarkdown::render: https://github.com/rstudio/packrat/blob/3df1d62f77e98f846b11636b4a3203b925ec1028/R/dependencies.R#L665

aronatkins commented 2 years ago

The eventual deployment fails with the rendering error:

Tweaking _book/404.html
Error in xml_children(x)[[search]] : subscript out of bounds
Calls: local ... bs4_chapter_tweak -> tweak_navbar -> template_link_icon -> <Anonymous>
Execution halted
Error: bookdown::render_book() failed to render the output format 'bookdown::bs4_book'.

The 404.html file is created as a side-effect of the deploy-time rmarkdown::render call.

aronatkins commented 2 years ago

Resolved with #647; NEWS appearing shortly.