简体   繁体   English

编织 R Markdown 时出现“错误:pandoc 文档转换失败,错误 1”

[英]“Error: pandoc document conversion failed with error 1” when knitting R Markdown

I am troubleshooting a less-experienced R user's issue.我正在对经验不足的 R 用户问题进行故障排除。 She is attempting to knit a report that I created.她正在尝试编写我创建的报告。 The error started after her laptop was re-imaged, and R/RStudio had to be re-installed.该错误是在她的笔记本电脑重新映像后开始的,并且必须重新安装 R/RStudio。 Previously she could knit the report, and I can still knit the file without an error.以前她可以编织报告,我仍然可以编织文件而不会出错。

The error occurs when it tries to create the file-- it's not an issue with the code.当它尝试创建文件时会发生错误——这不是代码的问题。 The normal procedure for knitting is to run a.R script, with rmarkdown::render() knitting the html and then writing it out to a different location with a different name.编织的正常过程是运行 a.R 脚本,使用rmarkdown::render()编织 html,然后将其写入具有不同名称的不同位置。 If she manually knits the.Rmd she still gets the error but the.html file with the same name as the.Rmd gets created.如果她手动编织.Rmd,她仍然会收到错误,但会创建与.Rmd 同名的.html 文件。

rmarkdown::render("CODE\\SPEECHMINER_MAINTENANCE.RMD", output_format = "html_document", output_dir = "OUTPUT",
            output_file = paste0("SPEECHMINER_MAINTENANCE_REPORT_", format(Sys.Date(), "%Y-%m-%d"), ".html")
)

Below is her session info.以下是她的 session 信息。 As I said earlier, everything is up-to-date because they had to do a fresh install.正如我之前所说,一切都是最新的,因为他们必须进行全新安装。 Her RStudio is 1.2.x, I can get that if necessary.她的 RStudio 是 1.2.x,如果需要,我可以得到。

sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rmarkdown_1.16

loaded via a namespace (and not attached):
[1] compiler_3.6.1  htmltools_0.4.0 tools_3.6.1     Rcpp_1.0.2      knitr_1.25      xfun_0.10       digest_0.6.21   rlang_0.4.0     evaluate_0.14

From what I've read online the typical advise is to update everything.根据我在网上阅读的内容,典型的建议是更新所有内容。 In this case the update precipitated the problem.在这种情况下,更新引发了问题。 My system is not as updated.我的系统没有更新。 I'm on R 3.4.4, RStudio 1.1.x, knitr 1.22 and rmarkdown 1.12.我在 R 3.4.4、RStudio 1.1.x、knitr 1.22 和 rmarkdown 1.12 上。 I don't know much about how pandoc works and I'm thinking that must be the issue-- I'm sure that many folks are able to do this process successfully with the updated versions of R/RStudio/the packages.我不太了解 pandoc 是如何工作的,我认为这一定是问题所在——我相信很多人都能够使用 R/RStudio/软件包的更新版本成功地完成这个过程。

Today I found a solution:今天我找到了一个解决方案:

In enterprise you have two repositories of file shares在企业中,您有两个文件共享存储库

  • //societe/test_X //社团/test_X
  • J:/societe/test_X J:/societe/test_X

If you open your rmd file with the first version, you'll get a pandoc runtime error, but if use the second one, it will succeed.如果您使用第一个版本打开rmd文件,您将收到 pandoc 运行时错误,但如果使用第二个版本,它将成功。

Remark: J is not a local repository备注: J不是本地仓库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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