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

Error when installing usethis with pak::pak("r-lib/usethis") #1892

Closed
bbitarello opened this issue Sep 5, 2023 · 1 comment
Closed

Error when installing usethis with pak::pak("r-lib/usethis") #1892

bbitarello opened this issue Sep 5, 2023 · 1 comment

Comments

@bbitarello
Copy link

Hello, I have been trying for hours to install gradethis and keep getting the same error:

# insert reprex here
> pak::pak("r-lib/usethis")
Error:                                                     
! error in pak subprocess
Caused by error: 
! Could not solve package dependencies:
* r-lib/usethis: ! pkgdepends resolution error for r-lib/usethis.
Caused by error: 
! Bad GitHub credentials, make sure that your GitHub token is valid.
Caused by error in `stop(http_error(resp))`:
! Unauthorized (HTTP 401).
Type .Last.error to see the more details.

I thought it could be a github PAT issue so I reset it using:

#install.packages("gitcreds")
library(gitcreds)
gitcreds_set()

The error persists.

> sessionInfo()
R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.5.1

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/New_York
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] gitcreds_0.1.2     learnr_0.11.4.9000

loaded via a namespace (and not attached):
 [1] cli_3.6.1         knitr_1.43        rlang_1.1.1       xfun_0.39         processx_3.8.2    promises_1.2.0.1 
 [7] shiny_1.7.4.1     jsonlite_1.8.7    xtable_1.8-4      glue_1.6.2        rprojroot_2.0.3   htmltools_0.5.5  
[13] httpuv_1.6.11     ps_1.7.5          pak_0.6.0         rmarkdown_2.23    evaluate_0.21     ellipsis_0.3.2   
[19] fastmap_1.1.1     yaml_2.3.7        lifecycle_1.0.3   compiler_4.3.1    htmlwidgets_1.6.2 Rcpp_1.0.11      
[25] rstudioapi_0.15.0 later_1.3.1       digest_0.6.33     R6_2.5.1          callr_3.7.3       magrittr_2.0.3   
[31] tools_4.3.1       withr_2.5.0       mime_0.12     

Help will be appreciated!
Thank you

@jennybc
Copy link
Member

jennybc commented Sep 15, 2023

I would take the error at face value and use PAT troubleshooting strategies.

usethis offers some functions to help with this:

usethis::gh_token_help()
# or
usethis::git_sitrep()

It is also possible that maybe you have a bad PAT stored as an environment variable? That is described here:

https://usethis.r-lib.org/articles/git-credentials.html#what-about--renviron

@hadley hadley closed this as completed Oct 31, 2023
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