Building on this previous issue: https://github.com/rstudio/rmarkdown/issues/1285
Trying to download into HTML (or PDF) from a Shiny app using rmarkdown
. But error message:
Error in tools::file_path_as_absolute: file '/tmp/RtmpCjHU3c/report.Rmd' does not exist
Using the generic example produces the error:
ui <- fluidPage(
sliderInput("slider", "Slider", 1, 100, 50),
downloadButton("report", "Generate report")
)
server <- function(input,output) {
output$report <- downloadHandler(
filename = "report.html",
content = function(file) {
tempReport <- file.path(tempdir(), "report.Rmd")
file.copy("report.Rmd", tempReport, overwrite = TRUE)
params <- list(n = input$slider)
rmarkdown::render(tempReport, output_file = file,
params = params,
envir = new.env(parent = globalenv())
)})}
shinyApp(ui = ui, server = server)
I have installed tinytex
version 0.5 and rmarkdown
version 1.8, as per:
Knitr wont compile PDF: "Error in tools::file_path_as_absolute(output_file)"
I am running Ubuntu 16.04.4 on Amazon AWS.
For what it's worth, I am using TeX Live
and knitr
works fine to generate PDFs from within a standard rmarkdown
document.
I tried the following as well:
tinytex::install_tinytex()
Which produced the following error:
Error: Detected an existing tlmgr at /usr/bin/tlmgr. It seems TeX Live has been installed (check tinytex:::texlive_root()). You have to uninstall it, or use install_tinytex(force = TRUE) if you are sure TinyTeX can override it (e.g., you are a PATH expert or installed TinyTeX previously).
Despite not being a PATH expert, I forced install, which produced:
Error in root_dir(normalizePath(path), "..", "..", "..") : /usr/share/texlive does not seem to be the root directory of TeXLive (no "bin/" dir under it)
Going to try this patch next:
https://github.com/yihui/tinytex/blob/master/R/install.R
Hopefully it works for Linux.
Any suggestions would be helpful!