pandoc version 1.12.3 or higher is required and was not found (R shiny)

匿名 (未验证) 提交于 2019-12-03 01:19:01

问题:

I have a problem generating a pdf report from my app shiny which is hosted on a server.

the app works fine but when I press the button to download the report, I get this error :

 pandoc version 1.12.3 or higher is required and was not found. 

The proble is that if I type pandoc -v I get:

 pandoc 1.12.3.3  Compiled with texmath 0.6.6, highlighting-kate 0.5.6.1. Syntax highlighting is supported for the following languages:     actionscript, ada, apache, asn1, asp, awk, bash, bibtex, boo, c, changelog,     clojure, cmake, coffee, coldfusion, commonlisp, cpp, cs, css, curry, d,     diff, djangotemplate, doxygen, doxygenlua, dtd, eiffel, email, erlang,     fortran, fsharp, gnuassembler, go, haskell, haxe, html, ini, java, javadoc,     javascript, json, jsp, julia, latex, lex, literatecurry, literatehaskell,     lua, makefile, mandoc, markdown, matlab, maxima, metafont, mips, modelines,     modula2, modula3, monobasic, nasm, noweb, objectivec, objectivecpp, ocaml,     octave, pascal, perl, php, pike, postscript, prolog, python, r,     relaxngcompact, restructuredtext, rhtml, roff, ruby, rust, scala, scheme,     sci, sed, sgml, sql, sqlmysql, sqlpostgresql, tcl, texinfo, verilog, vhdl,     xml, xorg, xslt, xul, yacc, yaml  Default user data directory: /home/daniele/.pandoc  Copyright (C) 2006-2013 John MacFarlane  Web:  http://johnmacfarlane.net/pandoc  This is free software; see the source for copying conditions.  There is no  warranty, not even for merchantability or fitness for a particular purpose. 

So I suppose I have the right version for that. TexLive is also installed and the path is in $PATH.

Server.R

library(shiny) library(drsmooth) library(shinyBS) library(knitr) library(xtable) library(rmarkdown)  shinyServer(function(input, output,session) {    output$downloadReport 

* report.Rmd* does not contain any sort of calculation, it's only text. The pdf generation works fine on my local version (MacOS) but not on the server.

Thanks in advance, and I'm here to give other information if needed.

Daniele

回答1:

Go into RStudio and find the system environment variable for RSTUDIO_PANDOC

Sys.getenv("RSTUDIO_PANDOC") 

Then put that in your R script prior to calling the render command.

Sys.setenv(RSTUDIO_PANDOC="--- insert directory here ---") 

This worked for me after I'd been struggling to find how rmarkdown finds pandoc. I had to check github to look at the source.



回答2:

Another option so that this works for all your R scripts is to define this variable globally.

On Debian/Ubuntu, add the following line to your .bashrc file:

export RSTUDIO_PANDOC=/usr/lib/rstudio/bin/pandoc 

On macOS, add the following to your .bash_profile file:

export RSTUDIO_PANDOC=/Applications/RStudio.app/Contents/MacOS/pandoc 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!