Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to "Build Book" use the bookdown-demo #66

Open
richardgao1992 opened this issue Mar 31, 2022 · 4 comments
Open

Unable to "Build Book" use the bookdown-demo #66

richardgao1992 opened this issue Mar 31, 2022 · 4 comments

Comments

@richardgao1992
Copy link

Hello,

I just forked and cloned this repo, installed TinyTeX and tried building the book as instructed, however I encountered the following error (I got the same error before installing TinyTeX as well):
processing file: bookdown-demo.Rmd
|........ | 11%
inline R code fragments

|................ | 22%
label: unnamed-chunk-1 (with options)
List of 1
$ eval: logi FALSE

|....................... | 33%
ordinary text without R code

|............................... | 44%
label: unnamed-chunk-2 (with options)
List of 1
$ include: logi FALSE

Quitting from lines 32-36 (bookdown-demo.Rmd)
Error in parse(con) : 4:12: unexpected INCOMPLETE_STRING
3: title = "Welcome to the {tidyverse}",
4: author = "Hadley Wickham, Mara Averick, Jennifer Bryan, Winston Chang, Lucy D'Agostino McGowan, Romain Fran
^
Calls: local ... -> readCitationFile -> -> parse
Execution halted
Error: bookdown::render_book() failed to render the output format 'bookdown::gitbook'.
Execution halted

Exited with status 1.

sessionInfo

@yihui
Copy link
Member

yihui commented Mar 31, 2022

I can't reproduce this problem. Could you run bookdown::render_book() in the R console? If it throws the same error, please provide traceback() output.

@richardgao1992
Copy link
Author

bookdown::render_book()
Rendering book in directory '.'

processing file: bookdown-demo.Rmd
|.......... | 11%
inline R code fragments

|................... | 22%
label: unnamed-chunk-1 (with options)
List of 1
$ eval: logi FALSE

|............................. | 33%
ordinary text without R code

|...................................... | 44%
label: unnamed-chunk-2 (with options)
List of 1
$ include: logi FALSE

Quitting from lines 32-36 (bookdown-demo.Rmd)
Error in parse(con) : 4:12: unexpected INCOMPLETE_STRING
3: title = "Welcome to the {tidyverse}",
4: author = "Hadley Wickham, Mara Averick, Jennifer Bryan, Winston Chang, Lucy D'Agostino McGowan, Romain Fran
^

traceback()
31: parse(con)
30: tools:::.parse_CITATION_file(file, meta$Encoding)
29: readCitationFile(citfile, meta)
28: utils::citation(..., lib.loc = lib.loc)
27: citation(pkg, auto = FALSE)
26: FUN(X[[i]], ...)
25: lapply(x, function(pkg) {
if (pkg == "base")
return()
if (system.file("CITATION", package = pkg) == "")
return()
cites = citation(pkg, auto = FALSE)
cites = Filter(x = cites, function(cite) {
!isTRUE(grepl("R package version", cite$note))
})
s = make_unique(unlist(lapply(cites, function(cite) {
if (is.null(cite$year))
format(Sys.Date(), "%Y")
else cite$year
})))
mapply(cites, s, FUN = function(cite, suffix) {
if (isTRUE(grepl("R package version", cite$note)))
return()
entry = toBibtex(cite)
entry[1] = sub("\{,$", sprintf("{%s%s,", pkg, suffix),
entry[1])
...
24: knitr::write_bib(c(.packages(), "bookdown", "knitr", "rmarkdown"),
"packages.bib")
23: eval(expr, envir, enclos)
22: eval(expr, envir, enclos)
21: eval_with_user_handlers(expr, envir, enclos, user_handlers)
20: withVisible(eval_with_user_handlers(expr, envir, enclos, user_handlers))
19: withCallingHandlers(withVisible(eval_with_user_handlers(expr,
envir, enclos, user_handlers)), warning = wHandler, error = eHandler,
message = mHandler)
18: handle(ev <- withCallingHandlers(withVisible(eval_with_user_handlers(expr,
envir, enclos, user_handlers)), warning = wHandler, error = eHandler,
message = mHandler))
17: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval_with_user_handlers(expr,
envir, enclos, user_handlers)), warning = wHandler, error = eHandler,
message = mHandler)))
16: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,
debug = debug, last = i == length(out), use_try = stop_on_error !=
2L, keep_warning = keep_warning, keep_message = keep_message,
output_handler = output_handler, include_timing = include_timing)
15: evaluate::evaluate(...)
14: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning),
keep_message = !isFALSE(options$message), stop_on_error = if (is.numeric(options$error)) options$error else {
if (options$error && options$include)
0L
else 2L
}, output_handler = knit_handlers(options$render, options))
13: in_dir(input_dir(), expr)
12: in_input_dir(evaluate(code, envir = env, new_device = FALSE,
keep_warning = !isFALSE(options$warning), keep_message = !isFALSE(options$message),
stop_on_error = if (is.numeric(options$error)) options$error else {
if (options$error && options$include)
0L
else 2L
}, output_handler = knit_handlers(options$render, options)))
11: eng_r(options)
10: block_exec(params)
9: call_block(x)
8: process_group.block(group)
7: process_group(group)
6: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),
error = function(e) {
setwd(wd)
cat(res, sep = "\n", file = output %n% "")
message("Quitting from lines ", paste(current_lines(i),
collapse = "-"), " (", knit_concord$get("infile"),
") ")
})
5: process_file(text, output)
4: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
3: rmarkdown::render(main, output_format, ..., clean = clean, envir = envir)
2: render_cur_session(files, main, config, output_format, clean,
envir, ...)
1: bookdown::render_book()

@yihui
Copy link
Member

yihui commented Apr 1, 2022

It looks like an encoding problem. The good news is that R 4.2.0 is coming soon, which should solve most encoding problems on Windows. For now, you can try the alpha version: https://cran.r-project.org/bin/windows/base/rtest.html

@cderv
Copy link
Collaborator

cderv commented Apr 1, 2022

Seems also a encoding issue to me. R does not manage to process this lette ç in Romain François in this reference in the bib file.

@Article{tidyverse2019,
  title = {Welcome to the {tidyverse}},
  author = {Hadley Wickham and Mara Averick and Jennifer Bryan and Winston Chang and Lucy D'Agostino McGowan and Romain François and Garrett Grolemund and Alex Hayes and Lionel Henry and Jim Hester and Max Kuhn and Thomas Lin Pedersen and Evan Miller and Stephan Milton Bache and Kirill Müller and Jeroen Ooms and David Robinson and Dana Paige Seidel and Vitalie Spinu and Kohske Takahashi and Davis Vaughan and Claus Wilke and Kara Woo and Hiroaki Yutani},
  year = {2019},
  journal = {Journal of Open Source Software},
  volume = {4},
  number = {43},
  pages = {1686},
  doi = {10.21105/joss.01686},
}

As a workaround, you can remove the bib file creation here, especially if you don't use it.

bookdown-demo/index.Rmd

Lines 32 to 35 in 5331ffc

# automatically create a bib database for R packages
knitr::write_bib(c(
.packages(), 'bookdown', 'knitr', 'rmarkdown'
), 'packages.bib')

And otherwise, remove this citation (which is probably included due to one of the tidyverse package).

For a full fix, we need to know if R 4.2 fix the issue for you or not. Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants