[英]Trying to knit Rmarkdown but getting pandoc.utils error or pandoc error 83
我是 Rmarkdown 的新手,正在尝试学习如何编写代码。 当我运行示例代码并编织时,它给了我以下错误:
*
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
*
我想也许我应该安装包“Pandoc.utils”,但是一旦我在 R 中调用了这个包,它就会出现这个错误:
包“pandoc.utils”不可用(对于 R 版本 3.6.0)
这是因为我有最新版本的 R 并且它无法安装旧版本的 pandoc 吗? 有谁知道发生了什么?
看起来 rmarkdown 找不到 pandoc。 RStudio 通常在your\\path\\to\\Rstudio\\bin\\pandoc
包含 pandoc 文件。 当您打开 RStudio 时,它会秘密设置一个名为RSTUDIO_PANDOC
的环境变量,rmarkdown 使用该变量来查找 pandoc。
运行命令Sys.getenv("RSTUDIO_PANDOC")
,它应该返回您的 pandoc 安装位置。 如果没有,那很可能是你的问题。
找到 RStudio 的安装位置后,您可以使用Sys.setenv(RSTUDIO_PANDOC = "your/path/to/Rstudio/bin/pandoc")
设置此环境变量。 之后(假设这是您的问题)您应该能够按预期编织文档。
我在 Windows 10 桌面上遇到了这个问题,并修复了它。
如果您使用 Rstudio,在 R Markdown 终端中出现错误之前有一个很长的命令。 它可能看起来像这样:
“C:/Users/15510/AppData/Local/Pandoc/pandoc”...
它与我的Sys.getenv("RSTUDIO_PANDOC")
不一致,即“C:/Program Files/RStudio/bin/pandoc/pandoc”
所以我从Windows的系统环境中删除了我的pandoc路径(C:/Users/15510/AppData/Local/Pandoc/pandoc),然后rmd可以成功运行,终端说:
"C:/Program Files/RStudio/bin/pandoc/pandoc" ...
PS我猜你已经在你的用户目录中安装了pandoc,也许你可以检查你的计算机系统路径。
不幸的是,以上都不适合我。 令人惊讶的是,断开与互联网的连接有所帮助。 可能这也会帮助别人。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.