R markdown compile error:
I ran into this problem when using Bookdown, and the accepted solution did not work in my context. I resolved it after figuring out what the "YAML front-matter of your RMarkdown file" is. With bookdown, there is a .travis.yml file and a _bookdown.yml file, but you want to leave these two alone and these are not what the error message is referencing.
The "front-matter" would be the top of your RMarkdown file (if using bookdown it would be the "index.Rmd" file), see screenshot below:
So just add always_allow_html: yes
to the YAML header as its own line and it should work as expected (or give you a different error)
Have you tried the following? (FROM: https://bookdown.org/yihui/bookdown/html-widgets.html)
install.packages("webshot")
webshot::install_phantomjs()
It worked for me. See also: https://github.com/rstudio/bookdown/issues/440