我正在尝试使用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
答案 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
文件夹中)