cli evaluation error on `create_from_github()` with dev usethis
simonpcouch opened this issue Β· comments
I ran into an issue this morning with dev usethis on usethis::create_from_github()
. I believe all one should need to do to reproduce is attempt to create_from_github()
with a path that exists already:
usethis::create_from_github("tidymodels/tune")
#> β Setting `fork = FALSE`.
#> Error in `fun(..., .envir = .envir)`:
#> ! Could not evaluate cli `{}` expression: `pth(path)`.
#> Caused by error in `enc2utf8(path)`:
#> ! argument is not a character vector
#> Type .Last.error to see the more details.
The head of .Last.error
is:
Backtrace:
1. usethis::create_from_github("tidymodels/tune")
2. usethis:::check_directory_is_empty(repo_path)
3. usethis:::ui_abort("{.path {pth(path)}} exists and is not an empty directory.")
4. cli::cli_abort(message, class = c(class, "usethis_error"), .envir = .envir, β¦
5. cli:::vcapply(message, format_inline, .envir = .envir)
Strangely, I don't see the error in reprex()
.
Can you you repeat the above but with destdir
specific explicitly? So that I can exactly reproduce what you're experiencing. (I'd like to remove the semi-magical default behaviour for destdir
from the equation.)
Ah, thanks:
usethis::create_from_github("tidymodels/tune", destdir = "~/Documents/rrr/")
#> βΉ Defaulting to "https" Git protocol.
#> β Setting `fork = FALSE`.
#> Error in "fun(..., .envir = .envir)": ! Could not evaluate cli `{}` expression: `pth(path)`.
#> Caused by error in `enc2utf8(path)`:
#> ! argument is not a character vector
Created on 2024-04-02 with reprex v2.1.0
I think I am hitting the same issue with a GHA:
ββ Sitrep ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Error in `fun(..., .envir = .envir)`:
! Could not evaluate cli `{}` expression: `config_path(pkg)`.
Caused by error in `config_path(pkg)`:
! Can't find '_pkgdown.yml'.
βΉ This is an internal error that was detected in the pkgdown package.
Please report it at <https://github.com/r-lib/pkgdown/issues> with a reprex (<https://tidyverse.org/help/>) and the full backtrace.
---
Backtrace:
1. pkgdown::deploy_to_branch(new_process = FALSE)
2. pkgdown::build_site_github_pages(pkg, ..., clean = clean)
3. pkgdown::build_site(pkg, preview = FALSE, install = install, new_process = new_process, β¦
4. pkgdown:::build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, β¦
5. pkgdown::pkgdown_sitrep(pkg)
6. pkgdown:::error_to_sitrep("URLs", check_urls(pkg))
7. base::tryCatch({ β¦
8. base::tryCatchList(expr, classes, parentenv, handlers)
9. base::tryCatchOne(expr, names, parentenv, handlers[[1L]])
10. base::doTryCatch(return(expr), name, parentenv, handler)
11. pkgdown:::check_urls(pkg)
12. cli::cli_abort(c("{config_path(pkg)} lacks {.field url}.", details), β¦
13. cli:::vcapply(message, format_inline, .envir = .envir)
14. base::vapply(X, FUN, FUN.VALUE = character(1), ..., USE.NAMES = USE.NAMES)
15. local FUN(X[[i]], ...)
16. cli::cli_fmt(fun(..., .envir = .envir), collapse = collapse, strip_newline = TRUE)
17. cli:::cli__rec(expr)
18. local fun(..., .envir = .envir)
19. cli:::cli__message("inline_text", list(text = glue_cmd(..., .envir = .envir, β¦
20. "id" %in% names(args)
21. cli:::glue_cmd(..., .envir = .envir, .call = sys.call(), .trim = FALSE)
22. cli:::glue(str, .envir = .envir, .transformer = transformer, .cli = TRUE, β¦
23. (function (expr) β¦
24. .transformer(expr, .envir) %||% character()
25. local .transformer(expr, .envir)
26. eval(expr, envir = envir) %??% cli_error(call. = caller, "Could not evaluate cli {.code {{}}} expression:\n {.code {abbrev(code, 20)}}.")
27. cli:::chain_error(expr, err, srcref = utils::getSrcref(sys.call()))
28. | base::withCallingHandlers({ β¦
29. base::eval(expr, envir = envir)
30. base::eval(expr, envir = envir)
31. pkgdown:::config_path(pkg)
32. cli::cli_abort("Can't find {.file _pkgdown.yml}.", .internal = TRUE)
33. | rlang::abort(message, ..., call = call, use_cli_format = TRUE, β¦
34. | rlang:::signal_abort(cnd, .file)
35. | base::signalCondition(cnd)
36. | (function (e) β¦
37. | cli:::throw_error(err, parent = e)
Removing worktree
Running git worktree remove /tmp/Rtmp5Frq5C/file1e0773fa0c30
Execution halted