It looks like rmarkdown can’t find pandoc. RStudio typically includes the pandoc files in yourpathtoRstudiobinpandoc
. When you open RStudio, it secretly sets an environment variable named RSTUDIO_PANDOC
which rmarkdown uses to find pandoc.
Run the command Sys.getenv("RSTUDIO_PANDOC")
, which should return the location of your pandoc installation. If it doesn’t, that is likely to be your problem.
Once you find where RStudio is installed, you can set this environment variable with Sys.setenv(RSTUDIO_PANDOC = "your/path/to/Rstudio/bin/pandoc")
. After that (assuming this is your problem) you should be able to knit the document as expected.
I had this problem at my Windows 10 desktop, and fixed it.
There is a long command before your error in the R Markdown terminal if you use Rstudio. It may looks like this:
“C:/Users/15510/AppData/Local/Pandoc/pandoc” …
And it is inconsistent with my Sys.getenv("RSTUDIO_PANDOC")
, which is “C:/Program Files/RStudio/bin/pandoc/pandoc”
So I remove my pandoc path(C:/Users/15510/AppData/Local/Pandoc/pandoc) from the system environment in Windows, and then the rmd can run successfully with the terminal saying this:
“C:/Program Files/RStudio/bin/pandoc/pandoc” …
P.S. I guess you have installed pandoc in your user directory, maybe you can check your system path of the computer.
Unfortunately, none of the above worked for me. Surprisingly, disconnecting from the internet helped. May be this will help someone else too.
I am new to Rmarkdown and trying to learn how to knit a code. when I run the sample code and knit, it gives me the following error:
*
Error running filter C:/Users/bbalamdari/Documents/R/win-library/3.6/rmarkdown/rmd/lua/pagebreak.lua:
...uments/R/win-library/3.6/rmarkdown/rmd/lua/pagebreak.lua:18: module 'pandoc.utils' not found:
no field package.preload['pandoc.utils']
no file 'C:PROGRA~2Pandocluapandocutils.lua'
no file 'C:PROGRA~2Pandocluapandocutilsinit.lua'
no file 'C:PROGRA~2Pandocpandocutils.lua'
no file 'C:PROGRA~2Pandocpandocutilsinit.lua'
no file 'C:PROGRA~2Pandoc..sharelua5.3pandocutils.lua'
no file 'C:PROGRA~2Pandoc..sharelua5.3pandocutilsinit.lua'
no file '.pandocutils.lua'
no file '.pandocutilsinit.lua'
no file 'C:PROGRA~2Pandocpandocutils.dll'
no file 'C:PROGRA~2Pandoc..liblua5.3pandocutils.dll'
no file 'C:PROGRA~2Pandocloadall.dll'
no file '.pandocutils.dll'
no file 'C:PROGRA~2Pandocpandoc.dll'
no file 'C:PROGRA~2Pandoc..liblua5.3pandoc.dll'
no file 'C:PROGRA~2Pandocloadall.dll'
no file '.pandoc.dll'
Error: pandoc document conversion failed with error 83
Execution halted
*
I thought perhaps I should install package”Pandoc.utils” but once I called the package in R, it gave this error:
package ‘pandoc.utils’ is not available (for R version 3.6.0)
Is this because I have the latest version of R and it cant install the older version of pandoc? does anyone know what is going on?
Thanks for the answer. It did return the location and it is in “C:/Program Files/RStudio/bin/pandoc”. The problem looks like is with “pandoc.utils”. Not sure if this is an extra or extension to pandoc but when I try to install, it says not available with (for R version 3.6.0)
No, staying disconnected from the internet did the trick for me.