rmarkdown 使用 googleVis 失败 - pandoc 不支持 https - 适用于 RStudio

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

我有一个使用 googleVis 库的 Rmarkdown 文档。 它在 RStudio 上运行良好。我只需按下 "Knit HTML" 按钮和 "voilá":我得到一个漂亮的 HTML。

但是,当我尝试在命令行上生成时,在 Pandoc 中出现错误。

我只是运行:

Rscript --verbose -e 'script.R'

其中 script.R 是:

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

我得到的错误是这样的:

 (.....)
 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 

注意:

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

但它适用于 RStudio...

你能帮忙吗?

RStudio 可能使用与您在命令行上获得的版本不同的 pandoc 版本...(参见 this issue。)

尝试安装最新的 pandoc 并确保你使用的是 pandoc -v