jacobbien / litr-project

Writing R Packages with Literate Programming
https://jacobbien.github.io/litr-project/
Other
37 stars 3 forks source link

When the first bookdown rendering is incomplete, the second rendering fails also. #34

Closed sangwon-hyun closed 1 year ago

sangwon-hyun commented 1 year ago
  1. Let's say I'm looking to render bookdown for the first time, using litr::render("index.Rmd", output_format = litr::litr_gitbook()).
  2. One of my Rmd files has an error, like trying x + 1 when x doesn't exist yet. The rendering will fail, with this error message:
    
    label: unnamed-chunk-9 (with options) 
    List of 1
    $ eval: logi TRUE

Quitting from lines 276-277 (_main.Rmd) Error in x + 1 : object 'x' not found Calls: local ... eval_with_user_handlers -> eval -> eval -> gen_diff_mat

Execution halted Error: Failed to run 'bookdown::render_book' in a new R session.

3. Noticing this error, I correct this, and try to render again, using the same command `litr::render(...)` as before.
4. Then, I get this error message:

litr::render("index.Rmd", output_format = litr::litr_gitbook()) Error in litr:::setup(package_dir) :

Please read your friendly litr error message here:

The directory /home/sangwonh/repos/flowsmooth/flowsmooth already exists and either was not created by litr or may have manual edits. In either case, please rename that directory (or delete it) and then try again.

Calls: local ... render_cur_session -> -> -> Execution halted Error: Failed to run 'bookdown::render_book' in a new R session.

But technically, /home/sangwonh/repos/flowsmooth/flowsmooth was created using litr!

jacobbien commented 1 year ago

Thanks @sangwon-hyun. This happens because the flowsmooth package was partially changed in the first call to litr::render() but then got interrupted. The fix for you for now is to delete flowsmooth and then rendering will work. However, you're right that this is an issue. In fact, I've been meaning to address this for a while. I'll bump it up in terms of priorities because it's definitely something that users will frequently encounter (I've just gotten very accustomed to deleting the partially generated package directory).

sangwon-hyun commented 1 year ago

Right, it's just an extra manual step I'd love to skip :) Thanks!

jacobbien commented 1 year ago

Closed by a09e2c1cc417f45d3809348a541ef2b57de5e022