2017-07-27 39 views
3

我試圖建立一個網站與pkgdown所以我跑pkgdown::build_site()錯誤:pandoc文檔轉換失敗,錯誤2與pkgdown/rmarkdown

這引發以下錯誤:

Building article 'index.html'

Error: pandoc document conversion failed with error 2

也有類似problem上SO但得到的答覆並沒有解決我的問題。

我的猜測是,這個問題是在my vignette頭目前是:

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

我試圖將其更改爲:

output: rmarkdown::html_vignette 

,因爲它是在pkgdown的vignette使用。當我使用該代碼時,出現錯誤,小插圖沒有生成。

--smart/-S has been removed. Use +smart or -smart extension instead. For example: pandoc -f markdown+smart -t markdown-smart. Try pandoc.exe --help for more information. 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

我改變了頭的建議here到:

output: 
    html_document: 
    smart: false 

這頭織毛衣一個小插曲,但使用build_site()時,我仍然得到同樣的錯誤pandoc。

Pandoc是2.0版本。 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

Matrix products: default

locale:

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

attached base packages: stats graphics grDevices utils
datasets methods base

other attached packages: pkgdown_0.1.0.9000 devtools_1.13.2

loaded via a namespace (and not attached): MASS_7.3-47
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
commonmark_1.2 rlang_0.1.1.9000

任何想法如何解決它?

編輯:

我跑在Ubuntu整個事情,我設法使它工作(見repo)。仍然不知道是什麼導致了這個問題。這裏是sessionInfo()輸出:

R version 3.3.3 (2017-03-06) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 16.04.2 LTS

locale:

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

attached base packages: stats graphics grDevices utils
datasets methods base

other attached packages: pkgdown_0.1.0.9000 devtools_1.13.1

loaded via a namespace (and not attached): 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

+1

不知道這個問題是你的小插曲。我認爲問題在於您的自述文件。嘗試使用'pkgdown :: build_home()'來查看是否有相同的錯誤。 –

+0

我在使用'build_home()'時發生錯誤,但我認爲這與README和vignette的基本原因相同。我在Ubuntu上構建了這個網站,將GitHub的repo從Windows上移除,然後嘗試再次構建一個網站,但失敗了。 – epo3

+0

嘗試在自述文件的開頭添加一個h1標題('#some title')。 –

回答

1

因爲參數--smart正在這裏使用的則會出現警告:... running command '"C:/PROGRA~2/Pandoc/pandoc" ... --smart ... "'。因爲Pandoc 2.0的--smart/-S has been removed,這是一個問題。因此,請從調用者或命令行中刪除--smart以解決此問題。

在Pandoc 2+中,smart的用法與任何其他擴展的用法相同。要啓用它,您可以將+smart附加到--to--from參數中,或者可能附加到兩者。要禁用,請追加-smart

例如:

--to html+smart

或許:

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

相關問題