devtools :: install_github错误:SEC_E_UNTRUSTED_ROOT-证书链是由不可靠的实体颁发的

时间:2019-09-05 19:23:42

标签: r curl certificate devtools

我正在尝试使用devtools公司(防火墙)墙的后面安装软件包:

library(devtools)
devtools::install_github("aryoda/tryCatchLog")

我收到一条错误消息:

Error: Failed to install 'unknown package' from GitHub:   schannel:
next InitializeSecurityContext failed: SEC_E_UNTRUSTED_ROOT (0x80090325)
- The certification chain was issued by an entity that is unreliable.

原因似乎是使用过的curl软件包,它产生与以下相同的错误:

library(curl)
curl::curl_fetch_memory("https://httpbin.org/get")

我该如何解决?

PS:我正在使用MS Windows 10

1 个答案:

答案 0 :(得分:0)

我找到了解决方法:

只有设置正确的HTTPS_PROXY,互联网连接才能在curl中起作用:

# insert your correct domain name and IP port here
Sys.setenv(https_proxy = "http://httpproxy.mycompany.com:1234")

devtools问题评论确实对我有所帮助: https://github.com/r-lib/devtools/issues/1610#issuecomment-333344548

更新1:

这是在R中设置HTTP(S)_PROXY的通用解决方案:

requires(curl)
requires(devtools)

proxy <- curl::ie_get_proxy_for_url("https://www.qwant.com/")

Sys.setenv(https_proxy=proxy)
# Sys.setenv(http_proxy=proxy)  # you could also set an HTTP proxy

devtools::install_github("aryoda/tryCatchLog") # should work now

您可以将此行添加到Rprofile.site文件(在R/etc文件夹中)

相关问题