【问题标题】:Error: pandoc document conversion failed with error 2 with pkgdown / rmarkdown错误:pandoc 文档转换失败,错误 2 与 pkgdown / rmarkdown
【发布时间】:2017-07-27 00:39:04
【问题描述】:

我正在尝试使用pkgdown 建立一个网站,所以我运行了pkgdown::build_site()

这会引发以下错误:

构建文章'index.html'

错误:pandoc 文档转换失败,错误 2

在 SO 上有一个类似的 problem,但答案并没有解决我的问题。

我的猜测是问题出在my vignette 的标题中,目前是:

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

我尝试将其更改为:

output: rmarkdown::html_vignette

因为它在 pkgdown 的vignette 中使用。当我使用该代码时,我遇到了一个错误,并且小插图没有构建。

--smart/-S 已被移除。请改用 +smart 或 -smart 扩展名。例如:pandoc -f markdown+smart -t markdown-smart。尝试 pandoc.exe --help 了解更多信息。错误: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 执行已停止

我按照here 的建议将标题更改为:

output:
  html_document: 
    smart: false

此标题编织了一个小插图,但在使用 build_site() 时我仍然遇到相同的 pandoc 错误。

Pandoc 是 2.0 版。 sessionInfo() 返回:

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

矩阵产品:默认

语言环境:

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

附加的基础包: 统计图形 grDevices 实用程序
数据集方法库

其他附加包: pkgdown_0.1.0.9000 devtools_1.13.2

通过命名空间加载(未附加):MASS_7.3-47
编译器_3.4.1 magrittr_1.5 R6_2.2.2 工具_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
commonmark_1.2 rlang_0.1.1.9000

有什么解决办法吗?

编辑:

我在 Ubuntu 上运行了整个程序,并设法让它工作(参见 repo)。仍然不知道是什么导致了这个问题。这是sessionInfo()的输出:

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

语言环境:

LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C
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_PAPER=en_GB.UTF-8 LC_NAME=C LC_ADDRESS=C
LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

附加的基础包:stats graphics grDevices utils
数据集方法库

其他附加包:pkgdown_0.1.0.9000 devtools_1.13.1

通过命名空间加载(未附加):MASS_7.3-45
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
stringi_1.1.2 stringr_1.2.0 digest_0.6.12 commonmark_1.2 rlang_0.1.1

【问题讨论】:

  • 不确定问题出在您的小插图上。我认为问题出在您的自述文件上。尝试使用pkgdown::build_home() 看看是否有同样的错误。
  • 我在使用build_home() 时确实遇到了错误,但我认为这与 README 和小插图的根本原因相同。我在 Ubuntu 上建站,将 repo 从 GitHub 拉到 Windows,然后尝试再次建站,但失败了。
  • 尝试在 README 文件的开头添加 h1 标头 (# some title)。
  • 还是不行。无论如何,它无法解释为什么我设法在 Ubuntu 上运行它,而不是在 Windows 上。
  • Linux > Windows 是解释。很遗憾,我目前没有 Windows 计算机来测试您的问题。

标签: r yaml r-markdown pandoc r-package


【解决方案1】:

发出警告是因为这里使用了参数--smart... running command '"C:/PROGRA~2/Pandoc/pandoc" ... --smart ... "'。因为--smart/-S has been removed 对于 Pandoc 2.0,这是一个问题。因此,请从调用者或命令行中删除 --smart 以解决此问题。

在 Pandoc 2+ 中, smart 的用法与任何其他扩展相同。要启用它,请将+smart 附加到--to--from 参数,或者可能同时附加到两者。要禁用,请附加-smart

例如:

--转html+smart

或许:

--来自markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-smart

【讨论】:

    猜你喜欢
    • 2018-02-23
    • 2017-07-14
    • 1970-01-01
    • 2016-04-13
    • 2019-10-14
    • 1970-01-01
    • 2017-05-08
    • 2015-01-14
    • 2015-09-02
    相关资源
    最近更新 更多