错误:输入文件不在同一目录中,请提供明确的 wd [英] Error: Input files not all in same directory, please supply explicit wd

查看:39
本文介绍了错误:输入文件不在同一目录中,请提供明确的 wd的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试构建大约 2 周前可以运行的 PDF 后,没有大惊小怪,在新安装了 R、R studio、bookdown 等的新机器上,我遇到了这个错误:

After trying to build a PDF that worked ~2 weeks ago, no fuss, on a new machine with a fresh install of R, R studio, bookdown, etc, I have this error:

Error: Input files not all in same directory, please supply explicit wd

我将 .Rmd 文件的章节分类到目录中,因此如果我将 rmd_subdirtrue 更改为 false,错误消失了,但是……我无法处理项目根目录中包含 4-7 个每个场景的 100 多个章节;我要疯了.

I have chapters of .Rmd files sorted into directories, and so if I change rmd_subdir from true to false, the error goes away, but... I just can't work with 100+ chapters containing 4-7 each scenes in the root of the project; I'll go insane.

我有 new_session: no在我的 _bookdown.yml 中,但这无济于事.

I have new_session: no in my _bookdown.yml, but that's not helping matters.

我对 R 的了解还不够,甚至无法开始诊断 - Google 返回4 (!) 结果,所有这些都是源代码.因此,我不确定要在此处包含哪些文件,所以请告诉我,我会将它们粘贴进去.

I don't know enough about R to even begin to diagnose this - Google returns 4 (!) results and all of them are source code. As such, I'm not sure which files to include here, so please let me know, and I'll paste them in.

我按下了 RStudio 中显示 Build Book 的按钮,它会滴答作响,并在片刻之后以 status 1 和上述错误退出.

I press the button that says Build Book in RStudio, and it ticks along and exits with status 1 and the above error after a moment.

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



processing file: book-book.Rmd
  |......................................................................| 100%
  ordinary text without R code


output file: book-book.knit.md

Error: Input files not all in same directory, please supply explicit wd
Execution halted

Exited with status 1.

index.Rmd

---
title: "F"
author: "TTil"
site: bookdown::bookdown_site
fontsize: 10pt
geometry: paperwidth=6in,paperheight=9in,margin=0.5in,heightrounded,twoside,includehead,includefoot,heightrounded
output:
  bookdown::gitbook:
    split_by: section
    config:
      toolbar:
        position: static
  bookdown::pdf_book:
    keep_tex: yes
    latex_engine: lualatex
    includes:
      in_header: preamble.tex
      before_body: before_body.tex
documentclass: book
link-citations: yes
linestretch: 1.15
links-as-notes: true
mainfont: "Inter"
---

_bookdown.yml

book_filename: 'book-book'
language:
  ui:
    chapter_name: ''
delete_merged_file: true
new_session: no
rmd_subdir: true

# Before We Begin {-}

test test replace me

我的文件结构如下:

index.Rmd
  - part-1/
     - ch01/
       - sc01.Rmd
       - sc02.Rmd
       ...
     - ch02/
     ...
  - part-2/
  ... 

因此我希望 sc01.Rmdsc02.Rmd 成为第一章, 然后它和它的兄弟成为 第一部分,等等第二部分, 第三部分, ...

and thus I expect sc01.Rmd and sc02.Rmd to become Chapter One, and then it and its siblings to be Part One, and so on and so forth for Part Two, Part Three, ...

正如我在上面所说的,这个 PDF 是两周前的原样(尽管是在不同的机器上).

As I've said above, this PDF was working as-is 2 weeksish ago (albeit on a different machine).

干杯.

推荐答案

更新:这已在 bookdown 的开发版本中修复:https://github.com/rstudio/bookdown 你可以通过 remotes::install_github('rstudio/bookdown').

Update: This has been fixed in the dev version of bookdown: https://github.com/rstudio/bookdown You can install it via remotes::install_github('rstudio/bookdown').

这可能与 bookdown 中的最新功能有关.由于您没有提供可重现的示例,我盲目猜测设置 options(bookdown.render.file_scope = FALSE) 可能会修复它.您可以在 Rmd 文档或 ~/.Rprofile 中设置此选项.

This might be related to a recent feature in bookdown. Since you didn't provide a reproducible example, my blind guess is that setting options(bookdown.render.file_scope = FALSE) might fix it. You can set this option in either your Rmd document or ~/.Rprofile.

这篇关于错误:输入文件不在同一目录中,请提供明确的 wd的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆