我正在使用 rocker 在带有 Linux 的 Mac 版本 12.6.1 上呈现 rmarkdown pdf。
在 bash 中:
cd /Users/user/Documents/Docker_Project/
touch Dockerfile
Dockerfile 包含:
FROM rocker/r-ver:4.2.2
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
wget \
graphviz \
perl && \
/rocker_scripts/install_pandoc.sh && \
install2.r rmarkdown
ENV RSTUDIO_PANDOC=/usr/lib/rstudio/bin/pandoc
COPY . /home/user
WORKDIR /home/user/
RUN Rscript -e "rmarkdown::render('Paper.Rmd')"
Paper.Rmd 包含:
---
title: "Factor Analysis"
output: html_document
date: "2023-04-04"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Methods
- Sample Text
在 bash 中:
docker build . -t analysis
出品:
=> ERROR [7/7] RUN Rscript -e "rmarkdown::render('Paper.Rmd')" 1.9s
------
> [7/7] RUN Rscript -e "rmarkdown::render('Paper.Rmd')":
#11 0.817
#11 0.817
#11 0.817 processing file: Paper.Rmd
#11 1.353 output file: Paper.knit.md
#11 1.353
#11 1.358 /usr/bin/pandoc +RTS -K512m -RTS Paper.knit.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output Paper.tex --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --embed-resources --standalone --highlight-style tango --pdf-engine pdflatex --variable graphics --variable 'geometry:margin=1in'
#11 1.850 ! sh: 1: pdflatex: not found
#11 1.850
#11 1.850 Error: LaTeX failed to compile Paper.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Paper.log for more info.
#11 1.850 In addition: Warning message:
#11 1.851 In system2(..., stdout = if (use_file_stdout()) f1 else FALSE, stderr = f2) :
#11 1.851 error in running command
#11 1.852 Execution halted
------
executor failed running [/bin/sh -c Rscript -e "rmarkdown::render('Paper.Rmd')"]: exit code: 1
我完全不知道错误是什么,也没有找到关于如何修复它的资源。任何帮助表示赞赏。也很高兴重新格式化、澄清或添加任何必要的信息。