Closed talgalili closed 2 years ago
What does .Last.error.trace
show you?
In your README.md
, you have this:
install.packages.2 <- function (pkg) if (!require(pkg)) install.packages(pkg);
I think that should have been
install.packages.2 <- function (pkg) if (!requireNamespace(pkg)) install.packages(pkg);
because normally you don't want to add things to the search list. But if you really want to use require()
, you need the character.only = TRUE
argument so that it doesn't try to load the package named "pkg".
Interesting, let me take a look :)
Output
> .Last.error.trace
Stack trace:
Process 17264:
1. pkgdown::build_site()
2. pkgdown:::build_site_external(pkg = pkg, examples = examples, ...
3. callr::r(function(..., crayon_enabled, crayon_colors, pkgdown_internet) { ...
4. callr:::get_result(output = out, options)
5. throw(newerr, parent = remerr[[2]])
x callr subprocess failed: there is no package called ‘pkg’
Process 17386:
17. (function (..., crayon_enabled, crayon_colors, pkgdown_internet) ...
18. pkgdown::build_site(...)
19. pkgdown:::build_site_local(pkg = pkg, examples = examples, run_dont_run = r ...
20. pkgdown:::build_home(pkg, override = override, preview = FALSE)
21. pkgdown:::build_home_index(pkg, quiet = quiet)
22. pkgdown:::render_page(pkg, "home", data, "index.html", quiet = quiet)
23. pkgdown:::tweak_page(html, name, pkg = pkg)
24. downlit::downlit_html_node(html)
25. downlit:::tweak_children(x, xpath_block, highlight, pre_class = "downlit so ...
26. downlit:::map_chr(text, fun, ...)
27. base:::vapply(.x, .f, ..., FUN.VALUE = character(1), USE.NAMES = FALSE)
28. downlit:::FUN(X[[i]], ...)
29. downlit:::token_href(out$token, out$text)
30. downlit:::map_chr(text[fun], href_topic_local, is_fun = TRUE)
31. base:::vapply(.x, .f, ..., FUN.VALUE = character(1), USE.NAMES = FALSE)
32. downlit:::FUN(X[[i]], ...)
33. downlit:::find_rdname_attached(topic, is_fun = is_fun)
34. downlit:::is_exported(topic, package)
35. base:::`%in%`(name, getNamespaceExports(ns_env(package)))
36. base:::getNamespaceExports(ns_env(package))
37. base:::asNamespace(ns)
38. rlang:::ns_env(package)
39. base:::asNamespace(x)
40. base:::getNamespace(ns)
41. base:::loadNamespace(name)
42. base:::withRestarts(stop(cond), retry_loadNamespace = function() NULL)
43. base:::withOneRestart(expr, restarts[[1L]])
44. base:::doWithOneRestart(return(expr), restart)
45. base:::stop(cond)
46. (function (e) ...
x there is no package called ‘pkg’
That error is coming from downlit
, which wants to make a link to some topic, probably on the pkg
website.
Changing to use:
install.packages.2 <- function (pkg) if (!require(pkg, character.only = TRUE))
Seems to have solved it.
It still crashes (but because I'm missing a package). Is there a way to force skip it when this happens, instead of letting it crash?
> pkgdown::build_site()
-- Installing package into temporary library -------------------------------------------------
== Building pkgdown site =======================================================
Reading from: '/home/talgalili/Dropbox/aaaa good R code/AA - My packages/dendextend'
Writing to: '/home/talgalili/Dropbox/aaaa good R code/AA - My packages/dendextend/docs'
-- Initialising site -----------------------------------------------------------
-- Building home ---------------------------------------------------------------
Reading 'CONDUCT.md'
Writing '404.html'
-- Building function reference -------------------------------------------------
|
---------------------
Welcome to dendextend version 1.16.0
Type citation('dendextend') for how to cite the package.
Type browseVignettes(package = 'dendextend') for the package vignette.
The github page is: https://github.com/talgalili/dendextend/
Suggestions and bug-reports can be submitted at: https://github.com/talgalili/dendextend/issues
You may ask questions at stackoverflow, use the r and dendextend tags:
https://stackoverflow.com/questions/tagged/dendextend
To suppress this message use: suppressPackageStartupMessages(library(dendextend))
---------------------
/
Attaching package: ‘dendextend’
The following object is masked from ‘package:stats’:
cutree
Reading 'man/Bk.Rd'
Reading 'man/Bk_permutations.Rd'
Reading 'man/Bk_plot.Rd'
Reading 'man/DendSer.dendrogram.Rd'
Registered S3 method overwritten by 'seriation':
method from
reorder.hclust gclus
Reading 'man/FM_index.Rd'
Reading 'man/FM_index_R.Rd'
Reading 'man/FM_index_permutation.Rd'
Error in .f(.x[[i]], ...) : Failed to parse Rd in FM_index_permutation.Rd
ℹ there is no package called ‘psych’
Caused by error in `loadNamespace()`:
! there is no package called ‘psych’
Error: callr subprocess failed: Failed to parse Rd in FM_index_permutation.Rd
ℹ there is no package called ‘psych’
Caused by error in `loadNamespace()`:
! there is no package called ‘psych’
Type .Last.error.trace to see where the error occurred
(I can't seem to install psych
, but that's another issue, unrelated to pkgdown)
And thanks a lot @dmurdoch for the super fast and helpful responses!
I think the psych
issue might be fixed in the devel version of downlit
, by this commit: https://github.com/r-lib/downlit/commit/24ccb0b5d41a80583b1c998077fe528dd6c5af16 .
I take it back, I think the bug still occurs even after moving to use the following in README.md:
install.packages.2 <- function (pkg) {
if (!require(pkg, character.only = TRUE))
install.packages(pkg, character.only = TRUE)
}
Output
> pkgdown::build_home()
-- Building home ------------------------------------------------------------------------------
Reading 'CONDUCT.md'
Error in loadNamespace(name) : there is no package called ‘pkg’
I think there are issues in downlit
still. In particular, autolink_url()
calls href_expr
, and it doesn't handle library
, require
and requireNamespace
properly. I suspect that's where the problem arises. I'll open an issue there...
Reproduce (while working on the dendextend package):