jhelvy / renderthis

An R package for building xaringan slides into multiple outputs, including html, pdf, png, gif, pptx, and mp4.
https://jhelvy.github.io/renderthis
Other
173 stars 12 forks source link

Error in force(expr) : Failed to generate output in 30 seconds (timeout). #56

Open jorgesinval opened 2 years ago

jorgesinval commented 2 years ago

Hello!

I try to render a simple xaringan presentation:

---
title: "Example"
output: 
  xaringan::moon_reader:
    mathjax: "https://cdn.bootcss.com/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_HTMLorMML"
---

# Introduction

with the this code:

renderthis::to_pdf(from = "example.Rmd",
                   to = "example.pdf")

but I keep receiving an error:

(¬_¬)renderthis::to_pdf(from = "example.Rmd",
...                    to = "example.pdf")
✔ Rendering example.Rmd into example.html ... done
✖ Rendering example.html into example.pdf ... failed
Error in force(expr) : Failed to generate output in 30 seconds (timeout).

However, if I remove:

    mathjax: "https://cdn.bootcss.com/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_HTMLorMML"

it works:

(¬_¬)renderthis::to_pdf(from = "example.Rmd",
...                    to = "example.pdf")
✔ Rendering example.Rmd into example.html ... done
✔ Rendering example.html into example.pdf ... done
gadenbuie commented 2 years ago

There's an issue with that URL. Downloading it takes 15 seconds, opening it in a browser takes me about that long or longer. Maybe it's even slower in chromote?

system.time(
  download.file(
    "https://cdn.bootcss.com/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_HTMLorMML",
    "mathjax.js"
  )
)
trying URL 'https://cdn.bootcss.com/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_HTMLorMML'
downloaded 61 KB

   user  system elapsed 
  0.046   0.046  15.933 

You can try running this and adjusting wait time to see if it eventually completes.

to_html("example.Rmd")
pagedown::chrome_print("example.html", "example.pdf", wait = 45)
jorgesinval commented 2 years ago

Strangely, even after defining 120 seconds, I get:

(¬_¬)pagedown::chrome_print("example.html", "example.pdf", wait = 120)
Error in force(expr) : Failed to generate output in 30 seconds (timeout).

So, the error mentions 30 seconds.