2

我正在尝试将 R markdown 文件编织到 html/pdf 文档中。这是我收到的错误消息:

output file: test.knit.md

pandoc.exe: test.utf8.md: openBinaryFile: does not exist (No such file or directory)
Error: pandoc document conversion failed with error 1
Execution halted

No LaTeX installation detected (LaTeX is required to create PDF output). You should install a LaTeX distribution for your platform: https://www.latex-project.org/get/

  If you are not sure, you may install TinyTeX in R: tinytex::install_tinytex()

  Otherwise consider MiKTeX on Windows - http://miktex.org

  MacTeX on macOS - https://tug.org/mactex/
  (NOTE: Download with Safari rather than Chrome _strongly_ recommended)

  Linux: Use system package manager

我正在使用最新版本的 R、Rstudio 和 tinytex 软件包,并且我不在网络驱动器上工作(即 Rmd 文件位于 C:/ 中)。

我重新安装了 tinytex 导致一些错误消息:

tinytex::reinstall_tinytex()
If reinstallation fails, try install_tinytex() again. Then install the following packages:

tinytex::tlmgr_install(c("'\\ad.helsinki.fi\home\a\ann\Documents'", "CMD.EXE was started with the above path as the current directory.", "UNC paths are not supported.  Defaulting to Windows directory.", "amsfonts", "amsmath", "atbegshi", "atveryend", "auxhook", "babel", "bibtex", "bigintcalc", "bitset", "booktabs", "cm", "dehyph", "dvipdfmx", "dvips", "ec", "epstopdf-pkg", "etex", "etexcmds", "etoolbox", "euenc", "fancyvrb", "filehook", "firstaid", "float", "fontspec", "framed", "geometry", "gettitlestring", "glyphlist", "graphics", "graphics-cfg", "graphics-def", "grffile", "helvetic", "hycolor", "hyperref", "hyph-utf8", "hyphen-base", "iftex", "inconsolata", "infwarerr", "intcalc", "knuth-lib", "kpathsea", "kvdefinekeys", "kvoptions", "kvsetkeys", "l3backend", "l3kernel", "l3packages", "latex", "latex-amsmath-dev", "latex-bin", "latex-fonts", "latex-tools-dev", "latexconfig", "latexmk", "letltxmacro", "lm", "lm-math", "ltxcmds", "lua-alt-getopt", "luahbtex", "lualatex-math", "lualibs", "luaotfload", "luatex", "mdwtools", "metafont", "mfware", "modes", "ms", "natbib", "path", "pdfescape", "pdftex", "pdftexcmds", "plain", "refcount", "rerunfilecheck", "scheme-infraonly", "stringenc", "tex", "tex-ini-files", "texlive-scripts", "texlive.infra", "times", "tipa", "tlgs", "tlperl", "tlpsv", "tools", "unicode-data", "unicode-math", "uniquecounter", "url", "was", "xcolor", "xetex", "xetexconfig", "xkeyval", "xunicode", "zapfding"))

The directory C:\Users\ann\AppData\Roaming\TinyTeX/texmf-local is not empty. It will be backed up to C:\Users\ann\AppData\Local\Temp\RtmpWqoDNm\file1d1050f4326e and restored later.

tlmgr conf auxtrees remove "C:/PROGRA~1/R/R-40~1.3/share/texmf"
'\\ad.helsinki.fi\home\a\ann\Documents'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
'\\ad.helsinki.fi\home\a\ann\Documents'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
tlmgr conf auxtrees add "C:/PROGRA~1/R/R-40~1.3/share/texmf"
tlmgr install '\\ad.helsinki.fi\home\a\ann\Documents' CMD.EXE was started with the above path as the current directory. UNC paths are not supported.  Defaulting to Windows directory. path was
tlmgr.pl install: package '\\ad.helsinki.fi\home\a\ann\Documents' not present in repository.
tlmgr.pl install: package CMD.EXE not present in repository.
tlmgr.pl install: package Defaulting not present in repository.
tlmgr.pl install: package UNC not present in repository.
tlmgr.pl install: package Windows not present in repository.
tlmgr.pl install: package above not present in repository.
tlmgr.pl install: package are not present in repository.
tlmgr.pl install: package as not present in repository.
tlmgr.pl install: package current not present in repository.
tlmgr.pl install: package directory. not present in repository.
tlmgr.pl install: package not not present in repository.
tlmgr.pl install: package paths not present in repository.
tlmgr.pl install: package started not present in repository.
tlmgr.pl install: package supported. not present in repository.
tlmgr.pl install: package the not present in repository.
tlmgr.pl install: package to not present in repository.
tlmgr.pl install: package with not present in repository.
tlmgr.pl: package repository http://ctan.math.utah.edu/ctan/tex-archive/systems/texlive/tlnet (not verified: gpg unavailable)
[1/2, ??:??/??:??] install: path [6k]
[2/2, 00:00/00:00] install: was [4k]
tlmgr.pl: action install returned an error; continuing.
running mktexlsr ...
done running mktexlsr.
tlmgr.pl: An error has occurred. See above messages. Exiting.
tlmgr.pl: package log updated: C:/Users/ann/AppData/Roaming/TinyTeX/texmf-var/web2c/tlmgr.log
tlmgr update --self
tlmgr install '\\ad.helsinki.fi\home\a\ann\Documents' CMD.EXE was started with the above path as the current directory. UNC paths are not supported.  Defaulting to Windows directory. path was
tlmgr.pl install: package '\\ad.helsinki.fi\home\a\ann\Documents' not present in repository.
tlmgr.pl install: package CMD.EXE not present in repository.
tlmgr.pl install: package Defaulting not present in repository.
tlmgr.pl install: package UNC not present in repository.
tlmgr.pl install: package Windows not present in repository.
tlmgr.pl install: package above not present in repository.
tlmgr.pl install: package are not present in repository.
tlmgr.pl install: package as not present in repository.
tlmgr.pl install: package current not present in repository.
tlmgr.pl install: package directory. not present in repository.
tlmgr.pl install: package not not present in repository.
tlmgr.pl install: package paths not present in repository.
tlmgr.pl install: package started not present in repository.
tlmgr.pl install: package supported. not present in repository.
tlmgr.pl install: package the not present in repository.
tlmgr.pl install: package to not present in repository.
tlmgr.pl install: package with not present in repository.
tlmgr.pl: action install returned an error; continuing.
tlmgr.pl: package repository http://ctan.math.utah.edu/ctan/tex-archive/systems/texlive/tlnet (not verified: gpg unavailable)
tlmgr.pl install: package already present: path
tlmgr.pl install: package already present: was
tlmgr.pl: An error has occurred. See above messages. Exiting.

根据此处的建议,我尝试验证 R 是否可以找到编织所需的程序。似乎找不到它们。

Sys.which('pdflatex')
pdflatex 
      "" 

此外,似乎 tinytex 路径未添加到系统环境变量 PATH 中,因为在 Sys.getenv('PATH') 中找不到 tinytex_root() 路径(参见例如此处)。

tinytex::tinytex_root()
[1] "C:\\Users\\ann\\AppData\\Roaming\\TinyTeX"

 Sys.getenv('PATH')
[1] "C:\\Program Files\\R\\R-4.0.3\\bin\\x64;C:\\Program Files\\ImageMagick-7.0.8-Q16;C:\\Program Files (x86)\\Intel\\iCLS Client\\;C:\\Program Files\\Intel\\iCLS Client\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit\\;C:\\Users\\hriihima\\AppData\\Local\\Continuum\\anaconda3;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files\\Git\\cmd;C:\\HYAPP\\rtools3.5\\bin;C:\\HYAPP\\rtools3.5\\gcc-4.6.3\\bin;C:\\HYAPP\\rtools3.5\\mingw_32\\bin;C:\\HYAPP\\rtools3.5\\mingw_64\\bin;C:\\Program Files\\PuTTY\\;C:\\Program Files\\Common Files\\ThinPrint\\;C:\\Users\\ann\\AppData\\Local\\Microsoft\\WindowsApps;"

这是我的会话信息:

> xfun::session_info()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

Locale:
  LC_COLLATE=Finnish_Finland.1252  LC_CTYPE=Finnish_Finland.1252    LC_MONETARY=Finnish_Finland.1252 LC_NUMERIC=C                    
  LC_TIME=Finnish_Finland.1252    

Package version:
  base64enc_0.1.3 compiler_4.0.3  digest_0.6.27   evaluate_0.14   glue_1.4.2      graphics_4.0.3  grDevices_4.0.3 highr_0.8       htmltools_0.5.0
  jsonlite_1.7.1  knitr_1.30      magrittr_1.5    markdown_1.1    methods_4.0.3   mime_0.9        remotes_2.2.0   rlang_0.4.8     rmarkdown_2.5  
  stats_4.0.3     stringi_1.5.3   stringr_1.4.0   tinytex_0.26    tools_4.0.3     utils_4.0.3     xfun_0.18       yaml_2.2.1  

已编辑:再次安装tinytex也无济于事,我从编织中收到相同的错误消息。这是安装后打印的内容:

tinytex::install_tinytex()
trying URL 'https://yihui.org/tinytex/TinyTeX-1.zip'
Content type 'application/octet-stream' length 99792951 bytes (95.2 MB)
downloaded 95.2 MB

tlmgr conf auxtrees add "C:/PROGRA~1/R/R-40~1.3/share/texmf"
tlmgr install path was
tlmgr.pl: package repository https://mirror.las.iastate.edu/tex-archive/systems/texlive/tlnet (not verified: gpg unavailable)
[1/2, ??:??/??:??] install: path [6k]
[2/2, 00:01/00:01] install: was [4k]
running mktexlsr ...
done running mktexlsr.
tlmgr.pl: package log updated: C:/Users/annvirkk/AppData/Roaming/TinyTeX/texmf-var/web2c/tlmgr.log

安装 MiKTeX 后,我在编织文档时不再看到 Latex 问题,但与 openBinaryFile 相关的第一个错误仍然存​​在。这是我的示例 Rmd 脚本:

---
title: "test"
output:
  html_document: default
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```


testing

```{r}

print("hi")


### 1. Testing



```

这是它打印出来的错误消息:

output file: test.knit.md

pandoc.exe: test.utf8.md: openBinaryFile: does not exist (No such file or directory)
Error: pandoc document conversion failed with error 1
Execution halted

如何解决这些问题才能编写我的 Rmarkdown 文档?感谢帮助!

4

1 回答 1

0

也可以尝试安装Miketex,也像 Edo 说的,像 Rmarkdown 建议的那样安装 tinytex。

很明显你的问题只是没有安装乳胶,所以只需尝试重新安装并安装另一个乳胶程序,你应该很好编织!

于 2020-10-29T13:44:18.413 回答