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

devtools::dev_sitrep() returns a confusing error about root when not run properly #2127

Closed
lcolladotor opened this issue Sep 26, 2019 · 3 comments

Comments

@lcolladotor
Copy link

Hi,

After reading about devtools::dev_sitrep() I tried it blindly on a non-package directory. After checking #2105 and args(devtools::dev_sitrep) I realized that I should be running this function inside a package directory (unless I change the argument values) and that it works perfectly. However, the error message Error: Could not find package root. was confusing to me and maybe this could be improved.

Best,
Leo

R info

Incorrect use with confusing error:

> devtools::dev_sitrep()
Error: Could not find package root.
> install.packages('root')
Warning message:
packagerootis not available (for R version 3.6.1)
> devtools::dev_sitrep()
Error: Could not find package root.
> traceback()
4: stop("Could not find package root.", call. = FALSE)
3: package_file(path = x)
2: as.package(pkg)
1: devtools::dev_sitrep()
> options(width = 120)
> sessioninfo::session_info()
─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 3.6.1 (2019-07-05)
 os       macOS Mojave 10.14.6
 system   x86_64, darwin15.6.0
 ui       X11
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       America/New_York
 date     2019-09-26Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────
 package     * version date       lib source
 assertthat    0.2.1   2019-03-21 [1] CRAN (R 3.6.0)
 backports     1.1.4   2019-04-10 [1] CRAN (R 3.6.0)
 callr         3.3.2   2019-09-22 [1] CRAN (R 3.6.1)
 cli           1.1.0   2019-03-19 [1] CRAN (R 3.6.0)
 colorout    * 1.2-1   2019-07-27 [1] Github (jalvesaq/colorout@7ea9440)
 crayon        1.3.4   2017-09-16 [1] CRAN (R 3.6.0)
 desc          1.2.0   2018-05-01 [1] CRAN (R 3.6.0)
 devtools    * 2.2.1   2019-09-24 [1] CRAN (R 3.6.1)
 digest        0.6.21  2019-09-20 [1] CRAN (R 3.6.0)
 ellipsis      0.3.0   2019-09-20 [1] CRAN (R 3.6.0)
 fs            1.3.1   2019-05-06 [1] CRAN (R 3.6.0)
 glue          1.3.1   2019-03-12 [1] CRAN (R 3.6.0)
 magrittr      1.5     2014-11-22 [1] CRAN (R 3.6.0)
 memoise       1.1.0   2017-04-21 [1] CRAN (R 3.6.0)
 pkgbuild      1.0.5   2019-08-26 [1] CRAN (R 3.6.1)
 pkgload       1.0.2   2018-10-29 [1] CRAN (R 3.6.0)
 prettyunits   1.0.2   2015-07-13 [1] CRAN (R 3.6.0)
 processx      3.4.1   2019-07-18 [1] CRAN (R 3.6.0)
 ps            1.3.0   2018-12-21 [1] CRAN (R 3.6.0)
 R6            2.4.0   2019-02-14 [1] CRAN (R 3.6.0)
 Rcpp          1.0.2   2019-07-25 [1] CRAN (R 3.6.0)
 remotes       2.1.0   2019-06-24 [1] CRAN (R 3.6.0)
 rlang         0.4.0   2019-06-25 [1] CRAN (R 3.6.0)
 rprojroot     1.3-2   2018-01-03 [1] CRAN (R 3.6.0)
 sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 3.6.0)
 testthat    * 2.2.1   2019-07-25 [1] CRAN (R 3.6.0)
 usethis     * 1.5.1   2019-07-04 [1] CRAN (R 3.6.0)
 withr         2.1.2   2018-03-15 [1] CRAN (R 3.6.0)

[1] /Library/Frameworks/R.framework/Versions/3.6devel/Resources/library

Correct use:

## My default terminal directory is: /Users/lcollado/Dropbox/Code/
## I did this with `cd recount` but well, setwd() will work too:
> setwd('recount')
> devtools::dev_sitrep()
── R ───────────────────────────────────────────────────────────────────────────
* version: 3.6.1
* path: '/Library/Frameworks/R.framework/Versions/3.6/Resources/'
── devtools ────────────────────────────────────────────────────────────────────
* version: 2.2.1
── dev package ─────────────────────────────────────────────────────────────────
* package: 'recount'
* path: '/Users/lcollado/Dropbox/Code/recount/'All checks passed
@jimhester
Copy link
Member

I improved the error message when you run devtools functions outside of a package directory in (894bd53). You are actually the second person today who has misinterpreted the error to mean you need to install the 'root' package, so clearly it was confusing.

I also have modified dev_sitrep() to work without error when run outside a package directory in b722f80, which should close this issue.

@lcolladotor
Copy link
Author

Awesome! Thanks Jim =)

Best,
Leo

@lock
Copy link

lock bot commented Mar 27, 2020

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants