Search code examples
rstudior-markdownpandocgooglevis

rmarkdown fails using googleVis - pandoc does not support https - works on RStudio


I have a Rmarkdown document that uses googleVis library. It works fine on RStudio. I just press "Knit HTML" button and "voilá": I get a beautiful HTML.

However, when I try to generate on the command line, I get an error in Pandoc.

I just run:

Rscript --verbose -e 'script.R'

Where script.R is:

rmarkdown::render("inputFile.Rmd", output_dir=file.path("/path/to/my/dir"), output_file="outfile.html", encoding="UTF-8");

The error I get is this:

 (.....)
 output file: 5c86eb19-d29f-4ac6-ac35-87e72fb42bbd2787560825121738853.knit.md 

 /opt/local/bin/pandoc +RTS -K512m -RTS 5c86eb19-d29f-4ac6-ac35-87e72fb42bbd2787560825121738853.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output /Users/rodrigo/Documents/Nitryx/Technical/Projects/NitroERP/repository/5c86eb19-d29f-4ac6-ac35-87e72fb42bbd.html --smart --email-obfuscation none --self-contained --standalone --section-divs --table-of-contents --toc-depth 2 --variable toc_float=1 --variable toc_selectors=h1,h2 --variable toc_collapsed=1 --variable toc_smooth_scroll=1 --template /opt/local/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rmarkdown/rmd/h/default.html --number-sections --variable 'theme:bootstrap' --include-in-header /var/folders/dd/y3fs2t5j1n3fg8nfq1syrzym0000gn/T//RtmpTjWUT6/rmarkdown-str301943f9d761.html --mathjax --variable 'mathjax-url:https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --no-highlight --variable highlightjs=/opt/local/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rmarkdown/rmd/h/highlight --variable navigationjs=/opt/local/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rmarkdown/rmd/h/navigation-1.0  
 Fetching https://www.google.com/jsapi?callback=displayChartGaugeID30195c82acb7... 
 pandoc: Failed to retrieve https://www.google.com/jsapi?callback=displayChartGaugeID30195c82acb7 
 user error (https not supported) 
 Error: pandoc document conversion failed with error 61 
 Execution halted 

Note the:

pandoc: Failed to retrieve https://www.google.com/jsapi?callback=displayChartGaugeID30195c82acb7
user error (https not supported)

But it works on RStudio...

Can you help?


Solution

  • RStudio probably uses a different pandoc version than the one you get on the command line... (see e.g. this issue.)

    Try installing the newest pandoc and make sure you're using that with pandoc -v