首页 > 解决方案 > 即使我更新了最新的软件包,当我将默认文档编译为 pdf 时,Knit 也不起作用并且没有响应

问题描述

当我将默认的 R markdown 文档编织为 pdf、word 或 html 时,没有任何响应。当我单击 Knit ( )时,我基本上得到了一个黑匣子没有任何东西在运行也没有收到任何错误消息。Ctrl + Shift + K

截图附件可以在这里找到

我使用了大学桌面,所以我不确定这是否是由于管理问题导致我无法访问某些包 - 我的 R 脚本工作正常,我可以在 R markdown 中运行代码。我就是不能编织也不能得到任何错误信息。

我听从 Yihui Xie's Knit FAQ的建议并更新了所有软件包,重新启动并重新安装了 R studio 并尝试了devtools::install_version("rmarkdown", version = "1.8", repos = "http://cran.us.r-project.org")

sessionInfo()是这样的

> sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 16299)

Matrix products: default

locale:
[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252   
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C                      
[5] LC_TIME=English_Australia.1252    

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

other attached packages:
[1] markdown_0.9 knitr_1.23  

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.1        magrittr_1.5      usethis_1.5.0     devtools_2.0.2   
 [5] pkgload_1.0.2     R6_2.4.0          rlang_0.3.4       tools_3.5.3      
 [9] pkgbuild_1.0.3    xfun_0.7          sessioninfo_1.1.1 cli_1.1.0        
[13] withr_2.1.2       htmltools_0.3.6   remotes_2.0.4     yaml_2.2.0       
[17] assertthat_0.2.1  digest_0.6.19     rprojroot_1.3-2   crayon_1.3.4     
[21] processx_3.3.1    callr_3.2.0       fs_1.3.1          ps_1.3.0         
[25] testthat_2.1.1    glue_1.3.1        memoise_1.1.0     evaluate_0.14    
[29] rmarkdown_1.13    compiler_3.5.3    desc_1.2.0        backports_1.1.4  
[33] prettyunits_1.0.2 

任何人都可以建议我应该如何处理这个问题吗?非常感谢您提前。

更新时间:7/06/2019: 我在我的电脑上安装了latex,并使用了Yihui Xie's tinytex::install_tinytex(),得到如下信息。问题仍然存在 - 当我编织 (Ctrl+Shift+K) 时,什么也没发生,没有错误消息,没有 pdf,什么都没有。

> tinytex::install_tinytex()
MiKTeX-pdfTeX 2.9.6499 (1.40.18) (MiKTeX 2.9.6500 64-bit)
Copyright (C) 1982 D. E. Knuth, (C) 1996-2016 Han The Thanh
TeX is a trademark of the American Mathematical Society.
using bzip2 version 1.0.6, 6-Sept-2010
compiled with curl version 7.56.1; using libcurl/7.56.1 WinSSL
compiled with expat version 2.2; using expat_2.2.0
compiled with jpeg version 9.2
compiled with liblzma version 50020032; using 50020032
compiled with libpng version 1.6.34; using 1.6.34
compiled with libressl version LibreSSL 2.5.3; using LibreSSL 2.5.3
compiled with MiKTeX Application Framework version 2.6416; using 2.6416
compiled with MiKTeX Core version 3.6505; using 3.6516
compiled with MiKTeX Archive Extractor version 1.6300; using 1.6300
compiled with MiKTeX Package Manager version 1.6488; using 1.6488
compiled with poppler version 0.60.1
compiled with uriparser version 0.8.4
compiled with zlib version 1.2.11; using 1.2.11
trying URL 'http://mirror.ctan.org/systems/texlive/tlnet/install-tl.zip'
Content length 359 bytes
downloaded 21.5 MB

trying URL 'https://yihui.name/gh/tinytex/tools/pkgs-custom.txt'
Content length 81 bytes
downloaded 318 bytes

trying URL 'https://yihui.name/gh/tinytex/tools/tinytex.profile'
Content length 81 bytes
downloaded 295 bytes

Error in setwd(dir) : character argument expected
In addition: Warning messages:
1: Detected an existing LaTeX distribution (e.g., pdftex is at C:\PROGRA~1\MIKTEX~1.9\miktex\bin\x64\pdftex.exe). You are recommended to uninstall it, although TinyTeX should work well alongside another LaTeX distribution if a LaTeX document is compiled through tinytex::latexmk(). 
2: In unzip("install-tl.zip") : error 1 in extracting from zip file
Please quit and reopen your R session and IDE (if you are using one, such as RStudio or Emacs) and check if tinytex:::is_tinytex() is TRUE.

第二次更新 8/06/2019:重新安装 R 语言 3.5.3 版(由于大学软件管理政策,我目前无法使用 3.6 版)并尝试devtools::install_github('rstudio/rmarkdown')andupdate.packages()后,我可以 knitr 但收到以下错误消息:

"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS tte.utf8.md --to latex --
from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash 
--output tte.tex --template "C:\R\R-3.5.2\library\rmarkdown\rmd\latex\default-1.17.0.2.tex" 
--highlight-style tango --pdf-engine pdflatex --variable graphics=yes --variable "geometry:margin=1in" 
--variable "compact-title:yes" 
pandoc.exe: tte.utf8.md: openBinaryFile: does not exist (No such file or directory)
Error: pandoc document conversion failed with error 1
Execution halted

然后我尝试使用卸载 pandocbrew remove pandoc但收到此消息:

> brew remove pandoc
Error: unexpected symbol in "brew remove"

谢谢大家,就我使用 Rmarkdown 的问题提出建议,但不幸的是,问题仍然存在。

标签: rr-markdownknitr

解决方案


推荐阅读