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

Set QUARTO_R to be sure to run with the same R version as the current R session ? #204

Open
cderv opened this issue Jul 30, 2024 · 0 comments

Comments

@cderv
Copy link
Collaborator

cderv commented Jul 30, 2024

withr::with_envvar(
  list(QUARTO_R = fs::path(R.home(), "bin")), 
  withr::with_dir(temp_demo, quarto::quarto_render(as_job = FALSE))
)

I needed to do that because of this error

> withr::with_dir(temp_demo, quarto::quarto_render(as_job = FALSE))
[ 1/10] index.qmd
++ Activating rlang global_entrace



processing file: index.qmd
Error in `comment_chars[[engine]] %||% "#"`:
! could not find function "%||%"
Backtrace:
  1. global .main()
  2. execute(...)
  3. rmarkdown::render(...)
  4. knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
  5. knitr:::process_file(text, output)
     ...
  8. knitr (local) FUN(X[[i]], ...)
  9. knitr:::parse_block(g[-1], g[1], params.src, markdown_mode)
 10. knitr::partition_chunk(engine, code)
 11. xfun::divide_chunk(engine, code)
 12. xfun:::get_option_comment(engine)
Execution halted

could not find function "%||%"

xfun 0.46 only defines "%||%" for R 4.4 which is the version I used to call quarto_render(). But probably quarto renderCLI is using the default R version in the PATH which is4.3`. Somehow xfun was not handling this correctly... 🤔

Setting QUARTO_R solves it

Need to understand why.

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

1 participant