简体   繁体   English

devtools :: install_github因CA证书错误而失败

[英]devtools::install_github fails with CA cert error

When I try to call install_github, I get the following error (not just for this package, but for all github packages): 当我尝试调用install_github时,我收到以下错误(不仅是这个包,而是所有github包):

> install_github('ramnathv/slidify')
Downloading github repo ramnathv/slidify@master
Error in curl::curl_fetch_memory(url, handle = handle) :
Problem with the SSL CA cert (path? access rights?)

But if I use RCurl directly to access github with ssl, I don't get any problem: 但是,如果我直接使用RCurl来访问带有ssl的github,我不会遇到任何问题:

>  x <- getBinaryURL(
          url='https://github.com/ramnathv/slidify/archive/master.zip',
          followlocation=1L
          )

works with no errors, so RCurl can verify the SSL certificate properly and download the archive file. 无错误地工作,因此RCurl可以正确验证SSL证书并下载存档文件。

> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 8 (jessie)

locale:
 [1] LC_CTYPE=en_US.utf8       LC_NUMERIC=C             
 [3] LC_TIME=en_US.utf8        LC_COLLATE=en_US.utf8    
 [5] LC_MONETARY=en_US.utf8    LC_MESSAGES=en_US.utf8   
 [7] LC_PAPER=en_US.utf8       LC_NAME=C                
 [9] LC_ADDRESS=C              LC_TELEPHONE=C           
 [11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C      

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

other attached packages:
[1] RCurl_1.95-4.7 bitops_1.0-6   devtools_1.8.0

loaded via a namespace (and not attached):
 [1] httr_1.0.0      R6_2.1.0        magrittr_1.5    rversions_1.0.2
 [5] tools_3.2.1     curl_0.9.1      Rcpp_0.12.0     memoise_0.2.1  
 [9] xml2_0.1.1      stringi_0.5-5   git2r_0.10.1    stringr_1.0.0  
 [13] digest_0.6.8   

And

> curlVersion()

$age
[1] 3

$version
[1] "7.38.0"

$vesion_num
[1] 468480

$host
[1] "x86_64-pc-linux-gnu"

$features
   ipv6         ssl        libz        ntlm   asynchdns      spnego 
      1           4           8          16         128         256 
   largefile         idn tlsauth_srp     ntlm_wb 
    512        1024       16384       32768 

$ssl_version
[1] "OpenSSL/1.0.1k"

$ssl_version_num
[1] 0

$libz_version
[1] "1.2.8"

$protocols
[1] "dict"   "file"   "ftp"    "ftps"   "gopher" "http"   "https"  "imap"  
[9] "imaps"  "ldap"   "ldaps"  "pop3"   "pop3s"  "rtmp"   "rtsp"   "scp"   
[17] "sftp"   "smtp"   "smtps"  "telnet" "tftp"  

$ares
[1] ""

$ares_num
[1] 0

$libidn
[1] "1.29"

If I use httr::set_config( httr::config( ssl_verifypeer = 0L ) ) then I can successfully run install_github but I would prefer to actually check ssl certificates. 如果我使用httr::set_config( httr::config( ssl_verifypeer = 0L ) )那么我可以成功运行install_github但我更愿意实际检查ssl证书。

Can anyone offer a solution? 有人能提供解决方案吗?

Finally figured this out. 终于搞清楚了。

I had two different ssl libraries installed and for some reason, the RCurl package built against libcurl4-openssl-dev and the curl package built against libcurl4-nss-dev, but I had only installed CA keys for openssl, not for nss. 我安装了两个不同的ssl库,出于某种原因,针对libcurl4-openssl-dev构建的RCurl包和针对libcurl4-nss-dev构建的curl包,但我只为openssl安装了CA密钥,而不是为nss安装。

I solved my problem with remove.packages('curl') in R and then quitting R and from the shell apt-get remove libcurl4-nss-dev starting R and install.packages('curl') 我用R中的remove.packages('curl')解决了我的问题,然后退出R并从shell中apt-get remove libcurl4-nss-devapt-get remove libcurl4-nss-dev启动R和install.packages('curl')

My mistake, which led to my question, was to test the SSL CA handling using RCurl instead of httr or curl , which would have led me quickly to the fact that my curl package was linked to the wrong SSL library. 我的错误导致了我的问题,就是使用RCurl而不是httrcurl测试SSL CA处理,这会让我很快发现我的curl包链接到错误的SSL库。

If httr lib is missing the same error appears 如果缺少httr lib,则会出现相同的错误

try: 尝试:

install.packages("httr") install.packages( “HTTR”)

I removed httr (deleting the whole httr folder directly from my R win-library) and reinstalled it. 我删除了httr (直接从我的R win-library中删除整个httr文件夹)并重新安装它。 Then, installation from github worked smoothly 然后,从github安装工作顺利

When I use library swirl I met the same problem tooooo 当我使用库漩涡时,我遇到了同样的问题

After several try and find, I found that is because I haven't install openssl in R. 经过几次尝试找到,我发现那是因为我没有在R中安装openssl。

So: 所以:

install.packages("openssl")

then, everything ok! 那么,一切都好!

Oh! 哦! I am using Windows 10, not Linux 我使用的是Windows 10,而不是Linux

I was getting the same error with swirl while submitting assignments for Coursera. 在为Coursera提交作业时,我遇到了与漩涡相同的错误。 Uninstall and reinstall swirl itself, curl and htrr (which was also missing) did not address the issue. 卸载并重新安装漩涡本身,curl和htrr(也缺少)没有解决问题。 The only thing that actually worked was: 唯一真正有效的是:

install.packages("openssl") install.packages( “OpenSSL的”)

Also using Windows 10 and R 3.3.3. 还使用Windows 10和R 3.3.3。

确保,当前版本的R安装了包curlinstall.packages('curl')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM