首页 > 解决方案 > 在 R-studio 中安装“devtools”包时出现问题

问题描述

我已经尝试了几个小时来安装“devtools”包。每次它返回给我多个错误。最初我没有安装它的管理员权限,所以我以管理员身份运行,它最终尝试安装包。返回的是一系列错误,如下所示:

> install.packages("devtools")
Installing package into ‘/Users/ajadams968/R/library’
(as ‘lib’ is unspecified)
also installing the dependencies ‘gh’, ‘openssl’, ‘usethis’, ‘covr’, ‘httr’

trying URL 'https://cran.rstudio.com/src/contrib/gh_1.1.0.tar.gz'
Content type 'application/x-gzip' length 29043 bytes (28 KB)
==================================================
downloaded 28 KB

trying URL 'https://cran.rstudio.com/src/contrib/openssl_1.4.2.tar.gz'
Content type 'application/x-gzip' length 1204168 bytes (1.1 MB)
==================================================
downloaded 1.1 MB

trying URL 'https://cran.rstudio.com/src/contrib/usethis_1.6.3.tar.gz'
Content type 'application/x-gzip' length 254833 bytes (248 KB)
==================================================
downloaded 248 KB

trying URL 'https://cran.rstudio.com/src/contrib/covr_3.5.1.tar.gz'
Content type 'application/x-gzip' length 146686 bytes (143 KB)
==================================================
downloaded 143 KB

trying URL 'https://cran.rstudio.com/src/contrib/httr_1.4.2.tar.gz'
Content type 'application/x-gzip' length 159950 bytes (156 KB)
==================================================
downloaded 156 KB

trying URL 'https://cran.rstudio.com/src/contrib/devtools_2.3.1.tar.gz'
Content type 'application/x-gzip' length 373604 bytes (364 KB)
==================================================
downloaded 364 KB

* installing *source* package ‘openssl’ ...
** package ‘openssl’ successfully unpacked and MD5 sums checked
Thu Sep 17 16:33:13 CDT 2020: Auto-brewing openssl@1.1 in /private/tmp/RtmpdX1qXS/R.INSTALLbd2c2e4d6828/.autobrew/build-openssl@1.1...
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.
Using PKG_CFLAGS=-I/private/tmp/RtmpdX1qXS/R.INSTALLbd2c2e4d6828/.autobrew/build-openssl@1.1/opt/openssl@1.1/include -I/private/tmp/RtmpdX1qXS/R.INSTALLbd2c2e4d6828/.autobrew/build-openssl@1.1/opt/openssl/include
--------------------------- [ANTICONF] --------------------------------
Configuration failed because openssl was not found. Try installing:
 * deb: libssl-dev (Debian, Ubuntu, etc)
 * rpm: openssl-devel (Fedora, CentOS, RHEL)
 * csw: libssl_dev (Solaris)
 * brew: openssl@1.1 (Mac OSX)
If openssl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a openssl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
-------------------------- [ERROR MESSAGE] ---------------------------
tools/version.c:1:10: fatal error: 'openssl/opensslv.h' file not found
#include <openssl/opensslv.h>
         ^~~~~~~~~~~~~~~~~~~~
1 error generated.
--------------------------------------------------------------------
ERROR: configuration failed for package ‘openssl’
* removing ‘/Users/ajadams968/R/library/openssl’
Warning in install.packages :
  installation of package ‘openssl’ had non-zero exit status
ERROR: dependency ‘openssl’ is not available for package ‘httr’
* removing ‘/Users/ajadams968/R/library/httr’
Warning in install.packages :
  installation of package ‘httr’ had non-zero exit status
ERROR: dependency ‘httr’ is not available for package ‘gh’
* removing ‘/Users/ajadams968/R/library/gh’
Warning in install.packages :
  installation of package ‘gh’ had non-zero exit status
ERROR: dependency ‘httr’ is not available for package ‘covr’
* removing ‘/Users/ajadams968/R/library/covr’
Warning in install.packages :
  installation of package ‘covr’ had non-zero exit status
ERROR: dependency ‘gh’ is not available for package ‘usethis’
* removing ‘/Users/ajadams968/R/library/usethis’
Warning in install.packages :
  installation of package ‘usethis’ had non-zero exit status
ERROR: dependencies ‘usethis’, ‘covr’, ‘httr’ are not available for package ‘devtools’
* removing ‘/Users/ajadams968/R/library/devtools’
Warning in install.packages :
  installation of package ‘devtools’ had non-zero exit status

The downloaded source packages are in
    ‘/private/tmp/RtmpuFBrkf/downloaded_packages’

我也尝试过单独安装依赖项,但“openssl”包拒绝安装。我有一种感觉,整个问题是依赖项没有安装,但我不知道如何解决这个问题。任何帮助,将不胜感激。

标签: rinstallationpackage

解决方案


在我用 R 全新安装后,软件包安装工作,所以也许我以前的安装导致了这个问题。感谢您的协助。


推荐阅读