简体   繁体   English

错误:pandoc文档转换失败,错误2与pkgdown / rmarkdown

[英]Error: pandoc document conversion failed with error 2 with pkgdown / rmarkdown

I'm trying to build a website with pkgdown so I ran pkgdown::build_site() . 我正在尝试使用pkgdown构建一个网站,所以我运行了pkgdown::build_site()

This throws the following error: 这会引发以下错误:

Building article 'index.html' 构建文章'index.html'

Error: pandoc document conversion failed with error 2 错误:pandoc文档转换失败,错误2

There was a similar problem on SO but the answer didn't solve my issue. 在SO上有类似的问题 ,但答案并没有解决我的问题。

My guess was that the problem was in the header of my vignette which currently is: 我的猜测是问题出现在我的小插图的标题中,目前是:

output: 
  rmarkdown::html_vignette:
    smart: false
    toc: true

I tried changing it to: 我尝试将其更改为:

output: rmarkdown::html_vignette

as it is used in the pkgdown's vignette . 因为它在pkgdown的插图中使用 When I used that code, I got an error and the vignette did not build. 当我使用该代码时,我收到了一个错误,并且没有构建插图。

--smart/-S has been removed. --smart / -S已被删除。 Use +smart or -smart extension instead. 请改用+ smart或-smart扩展名。 For example: pandoc -f markdown+smart -t markdown-smart. 例如:pandoc -f markdown + smart -t markdown-smart。 Try pandoc.exe --help for more information. 尝试pandoc.exe --help以获取更多信息。 Error: pandoc document conversion failed with error 2 In addition: Warning message: running command '"C:/PROGRA~2/Pandoc/pandoc" +RTS -K512m -RTS Introduction.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output pandoc23e071f76af6.html --smart --email-obfuscation none --self-contained --standalone --section-divs --template "C:\\Users\\E\\Documents\\R\\win-library\\3.4\\rmarkdown\\rmd\\h\\default.html" --highlight-style pygments --css "C:\\Users\\E\\Documents\\R\\win-library\\3.4\\rmarkdown\\rmarkdown\\templates\\html_vignette\\resources\\vignette.css" --mathjax --variable "mathjax-url: https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML "' had status 2 Execution halted 错误:pandoc文档转换失败,错误2另外:警告消息:正在运行命令'“C:/ PROGRA~2 / Pandoc / pandoc”+ RTS -K512m -RTS Introduction.utf8.md - to html - from markdown + autolink_bare_uris + ascii_identifiers + tex_math_single_backslash --output pandoc23e071f76af6.html --smart --email-obfuscation none - self-contained --standalone --section-divs --template“C:\\ Users \\ E \\ Documents \\ R \\ win- library \\ 3.4 \\ rmarkdown \\ rmd \\ h \\ default.html“--highlight-style pygments --css”C:\\ Users \\ E \\ Documents \\ R \\ win-library \\ 3.4 \\ rmarkdown \\ rmarkdown \\ templates \\ html_vignette \\ resources \\ vignette.css“--mathjax --variable”mathjax-url: https ://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML“'状态为2执行暂停

I changed the header as suggested here to: 我按照此处的建议将标题更改为:

output:
  html_document: 
    smart: false

This header knits a vignette but I still get the same pandoc error when using build_site() . 这个标题编织了一个小插图,但在使用build_site()时我仍然得到相同的pandoc错误。

Pandoc is version 2.0. Pandoc是2.0版。 sessionInfo() returns: sessionInfo()返回:

R version 3.4.1 (2017-06-30) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1 R版本3.4.1(2017-06-30)平台:x86_64-w64-mingw32 / x64(64位)运行于:Windows 7 x64(build 7601)Service Pack 1

Matrix products: default Matrix产品:默认

locale: 区域:

LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C LC_COLLATE = English_United Kingdom.1252 LC_CTYPE = English_United Kingdom.1252 LC_MONETARY = English_United Kingdom.1252 LC_NUMERIC = C
LC_TIME=English_United Kingdom.1252 LC_TIME = English_United Kingdom.1252

attached base packages: stats graphics grDevices utils 附加的基础包:stats graphics grDevices utils
datasets methods base 数据集方法库

other attached packages: pkgdown_0.1.0.9000 devtools_1.13.2 其他附件包:pkgdown_0.1.0.9000 devtools_1.13.2

loaded via a namespace (and not attached): MASS_7.3-47 通过命名空间加载(而不是附加):MASS_7.3-47
compiler_3.4.1 magrittr_1.5 R6_2.2.2 tools_3.4.1 compiler_3.4.1 magrittr_1.5 R6_2.2.2 tools_3.4.1
withr_1.0.2 roxygen2_6.0.1 Rcpp_0.12.12 memoise_1.1.0 xml2_1.1.1 stringi_1.1.5 stringr_1.2.0 digest_0.6.12 withr_1.0.2 roxygen2_6.0.1 Rcpp_0.12.12 memoise_1.1.0 xml2_1.1.1 stringi_1.1.5 stringr_1.2.0 digest_0.6.12
commonmark_1.2 rlang_0.1.1.9000 commonmark_1.2 rlang_0.1.1.9000

Any ideas how to fix it? 任何想法如何解决它?

EDIT: 编辑:

I ran the whole thing on Ubuntu and I managed to make it work (see the repo ). 我在Ubuntu上运行了整个操作,并设法让它工作(参见回购 )。 Still don't know what was causing the issue. 仍然不知道是什么导致了这个问题。 Here is the output of sessionInfo() : 这是sessionInfo()的输出:

R version 3.3.3 (2017-03-06) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 16.04.2 LTS R版本3.3.3(2017-03-06)平台:x86_64-pc-linux-gnu(64位)运行于:Ubuntu 16.04.2 LTS

locale: 区域:

LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_CTYPE = en_GB.UTF-8 LC_NUMERIC = C.
LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8 LC_TIME = en_GB.UTF-8 LC_COLLATE = en_GB.UTF-8
LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 LC_MONETARY = en_GB.UTF-8 LC_MESSAGES = en_GB.UTF-8
LC_PAPER=en_GB.UTF-8 LC_NAME=C LC_ADDRESS=C LC_PAPER = en_GB.UTF-8 LC_NAME = C LC_ADDRESS = C.
LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C LC_TELEPHONE = C LC_MEASUREMENT = en_GB.UTF-8 LC_IDENTIFICATION = C

attached base packages: stats graphics grDevices utils 附加的基础包:stats graphics grDevices utils
datasets methods base 数据集方法库

other attached packages: pkgdown_0.1.0.9000 devtools_1.13.1 其他附件包:pkgdown_0.1.0.9000 devtools_1.13.1

loaded via a namespace (and not attached): MASS_7.3-45 通过命名空间加载(而不是附加):MASS_7.3-45
magrittr_1.5 R6_2.2.2 tools_3.3.3 withr_2.0.0 magrittr_1.5 R6_2.2.2 tools_3.3.3 withr_2.0.0
roxygen2_6.0.1 Rcpp_0.12.12 memoise_1.1.0 xml2_1.1.1 roxygen2_6.0.1 Rcpp_0.12.12 memoise_1.1.0 xml2_1.1.1
stringi_1.1.2 stringr_1.2.0 digest_0.6.12 commonmark_1.2 rlang_0.1.1 stringi_1.1.2 stringr_1.2.0 digest_0.6.12 commonmark_1.2 rlang_0.1.1

The warning is raised because the argument --smart is being used here: ... running command '"C:/PROGRA~2/Pandoc/pandoc" ... --smart ... "' . Because --smart/-S has been removed for Pandoc 2.0, that's a problem. So, remove --smart from the caller or command-line to fix this. 提出警告是因为在这里使用了--smart这个参数: ... running command '"C:/PROGRA~2/Pandoc/pandoc" ... --smart ... "' 。因为--smart/-S has been removed用于Pandoc 2.0,这是一个问题。所以,从调用者或命令行中删除--smart来解决这个问题。

In Pandoc 2+, usage of smart is the same as for any other extension. 在Pandoc 2+中,智能的使用与任何其他扩展的使用相同。 To enable it, you append +smart to either the --to or the --from argument it, or possibly to both. 要启用它,您将追加+smart要么在--to--from参数,或者可能是两者。 And to disable, append -smart . 要禁用,请附加-smart

For example: 例如:

--to html+smart - 到HTML +智能

Or maybe: 或者可能:

--from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-smart --from markdown + autolink_bare_uris + ascii_identifiers + tex_math_single_backslash-smart

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

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