简体   繁体   中英

Trying to knit Rmarkdown but getting pandoc.utils error or pandoc error 83

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~2\Pandoc\lua\pandoc\utils.lua'
    no file 'C:\PROGRA~2\Pandoc\lua\pandoc\utils\init.lua'
    no file 'C:\PROGRA~2\Pandoc\pandoc\utils.lua'
    no file 'C:\PROGRA~2\Pandoc\pandoc\utils\init.lua'
    no file 'C:\PROGRA~2\Pandoc\..\share\lua\5.3\pandoc\utils.lua'
    no file 'C:\PROGRA~2\Pandoc\..\share\lua\5.3\pandoc\utils\init.lua'
    no file '.\pandoc\utils.lua'
    no file '.\pandoc\utils\init.lua'
    no file 'C:\PROGRA~2\Pandoc\pandoc\utils.dll'
    no file 'C:\PROGRA~2\Pandoc\..\lib\lua\5.3\pandoc\utils.dll'
    no file 'C:\PROGRA~2\Pandoc\loadall.dll'
    no file '.\pandoc\utils.dll'
    no file 'C:\PROGRA~2\Pandoc\pandoc.dll'
    no file 'C:\PROGRA~2\Pandoc\..\lib\lua\5.3\pandoc.dll'
    no file 'C:\PROGRA~2\Pandoc\loadall.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?

It looks like rmarkdown can't find pandoc. RStudio typically includes the pandoc files in your\\path\\to\\Rstudio\\bin\\pandoc . 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" ...

PS 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM