内容提要:
### 解决方案:
1. dependencies = TRUE.
2. run as administrator.
3. update R and R related tools(eg: Rtools).
4. unload attached packages in initial start.
5. remove prior packages and reinstall it.
6. just try it again.
7. ……
problem
install.packages(packagedir , repos=NULL)
Hi, Dr., Welcome at Mon Jul 06 09:54:11 2020
ERROR: failed to lock directory 'D:/tools/R/R_Library' for modifying
Try removing 'D:/tools/R/R_Library/00LOCK-backports'
Warning in install.packages :
installation of package ‘C:/Users/D./Downloads/Compressed/backports_1.1.8.tar.gz’ had non-zero exit status
solving
delete the director "00LOCK"
result
> packagedir <- choose.files()
> install.packages(packagedir , repos=NULL)
* installing *source* package 'backports' ...
** package 'backports' successfully unpacked and MD5 sums checked
** using staged installation
** libs
problem
installation of package ‘tibble’ had non-zero exit status
solving
install.packages("tibble", dependencies = TRUE)
devtools::install_github("tidyverse/tibble")
result 1
Warning in install.packages :
installation of package ‘tibble’ had non-zero exit status
resolving 1
run as administration
install.packages("tibble", dependencies = TRUE)
result 2
Warning in install.packages :
installation of package ‘tibble’ had non-zero exit status
resolving 2
run as administration
devtools::install_github("tidyverse/tibble")
result 2
no warning
solved !
another example
I had the exact same issue just today. Running Rstudio with administrator rights did not solve the issue.
With me the problem was that my Rprofile loaded "usethis", "devtools", and "testthat" on startup. One or more of these packages loads "rlang", and this prevented "rlang" from being updated.
I solved it like this:
file.edit(file.path("~", ".Rprofile"))
Comment out all the loaded packages.
Restart session
install.packages("rlang")
I hope this helps.
网友评论