bookdown-demo可以构建pdf和epub,但是创建gitbook时出错

时间:2019-05-30 19:17:54

标签: r bookdown gitbook

我正在尝试为演示Bookdown文件创建gitbook格式的HTML输出。当我进行构建时,出现以下错误:

  1. 我正在使用RStudio版本1.1.463,r版本3.5.3和MiKTeX版本2.9
  2. 创建演示书的pdf或epub版本我没有问题
  3. 我的工作区位于单独的逻辑驱动器D:\R-Work\bookdown-demo-master上,因为我不想将任何工作保存在映射的网络文档文件夹中。
  4. 我的r库文件位于\\DRIFTWOODDC\Student\steven.taylor\My Documents\R\win-library\3.5

我的_output.yml文件并未从原始下载的版本中更改过:

bookdown::gitbook:
  css: style.css
  config:
    toc:
      before: |
        <li><a href="./">A Minimal Book Example</a></li>
      after: |
        <li><a href="https://github.com/rstudio/bookdown" target="blank">Published with bookdown</a></li>
    edit: https://github.com/rstudio/bookdown-demo/edit/master/%s
    download: ["pdf", "epub"]
bookdown::pdf_book:
  includes:
    in_header: preamble.tex
  latex_engine: xelatex
  citation_package: natbib
  keep_tex: yes
bookdown::epub_book: default

我期望RStudio为gitbook输出创建html文件,但没有创建任何文件,并且出现以下错误:

==> rmarkdown::render_site(output_format = 'bookdown::gitbook', encoding = 'UTF-8')

Error in system.file(..., package = "bookdown", mustWork = TRUE) : 
  no file found
Calls: <Anonymous> ... do.call -> <Anonymous> -> bookdown_file -> system.file
Execution halted

Exited with status 1.

如果我尝试以gitbook格式创建bookdown-crc模板文件,则会遇到相同的症状和问题。我可以创建pdf和epub,但不能创建html输出。

1 个答案:

答案 0 :(得分:0)

我执行了以下操作来排除故障:

  1. 将R和R Studio卸载并重新安装到新的逻辑驱动器,而不是默认位置。
  2. 将R_USER_LIBS环境变量更改为希望将库文件安装在新逻辑驱动器上的位置。我通过命令行安装了所有额外的库,而不是在构建过程中缺少这些库时让它们自动安装。

对于R库,使用网络驱动器似乎存在问题。在Windows工作计算机上,默认情况下,R库位于“我的文档”文件夹中。

第二种成功的方法是在USB驱动器上安装RPortable和RStudioPortable并使用便携式版本生成bookdown::gitbook