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
172 stars 12 forks source link

Error in onRejected(reason) : code: -32000 message: Browser window not found #77

Open privefl opened 2 weeks ago

privefl commented 2 weeks ago

renderthis::to_pdf() used to work fine, now I get this error a few months ago, I don't know why.

privefl commented 2 weeks ago

When I use partial_slides = FALSE, I get another error:

Error in force(expr) : 
  Failed to generate output. Reason: Failed to open http://127.0.0.1:4921/favicon.ico (HTTP status code: 404)
jhelvy commented 2 weeks ago

I also am getting this, it recently emerged. I don't think we changed anything to the package, so my guess is something changed in a dependency.

privefl commented 2 weeks ago

For the first error, I tried to change my default web browser to either Edge/Chrome/Firefox, But that didn't help.

robert-cope commented 2 weeks ago

I've also encountered this favico.ico error this week (late August 2024), on documents that converted successfully last week, and I haven't been able to work out what changed. I can make the renderthis::to_pdf() conversion work if I add the following html to the header: <link rel="shortcut icon" href="#" /> (which I believe means it won't look for a favicon.ico)

In practice I do this in the yaml of a Qmd source like:

format: 
  revealjs:
    include-in-header:
      - text: <link rel="shortcut icon" href="#" />
privefl commented 2 weeks ago

I tried to put this <link /> in an HTML file and use

output:
  xaringan::moon_reader:
    includes:
      in_header: "no_favicon.html"

But it does not change anything; am I doing anything wrong here?

robert-cope commented 2 weeks ago

Doing exactly that fixes the favicon error for me (when testing on the default xaringan template).

privefl commented 2 weeks ago

Okay, if I put this in no_favicon.html

<html>
<link rel="shortcut icon" href="#" />
</html>

or simply

<link rel="shortcut icon" href="#" />

it now works with partial_slides = FALSE. (I don't know why it didn't work the first time)


If then trying again with partial_slides = TRUE, I get the same initial error, or sometimes a new error:

Error: Chromote: timed out waiting for response to command Target.createTarget

jhelvy commented 2 weeks ago

Sorry everyone, I'm traveling this week so haven't had a chance to dig in and find the issue, but I suspect it has something to do with Chrome looking for a favicon, hopefully we can find a simple fix in the package itself so you don't have to insert that placeholder code. @gadenbuie if you have time can you take a look? I feel like we should be able to just inject that code to avoid the favicon somewhere, or the root issue might be something outside of renderthis.

gadenbuie commented 2 weeks ago

This little (quite big) bug is related to recent changes in Chrome to headless mode. Unfortunately, renderthis depends on both pagedown (complex_slides = FALSE) and chromote (complex_slides = TRUE), so we'll need fixes to happen in both of those packages first.

jhelvy commented 2 weeks ago

That's what I was afraid of :( Looks like for now people will have to do the hack suggested above before a fix is ready.