从github安装包时出错

时间:2013-05-24 17:09:49

标签: r github

我无法从github安装软件包:

> install_github('cranvas', 'ggobi', args="--no-multiarch")
Installing github repo(s) cranvas/master from ggobi
Installing cranvas.zip from https://github.com/ggobi/cranvas/archive/master.zip
Error in function (type, msg, asError = TRUE)  : couldn't connect to host

这是我的会议:

R version 3.0.1 (2013-05-16)
Platform: x86_64-pc-linux-gnu (64-bit)

注意:install.packages像往常一样工作,只是与github问题。有没有人遇到过这个?感谢

3 个答案:

答案 0 :(得分:7)

来自:http://healthvis.org/install/

使用上述说明时,有些用户遇到以下错误:函数错误(type,msg,asError = TRUE):无法连接到主机。这可能是由于使用代理(这会阻止您从github安装任何软件包),并且可以使用httr软件包进行纠正。在上面的install_github(...)之前运行以下命令:

install.packages("httr")
library(devtools)
library(httr)
set_config(use_proxy(url="http://proxyname.company.com",port=8080,username="XXX",password="XXX")) 
install_github("cranvas")

希望这有帮助。

答案 1 :(得分:7)

我遇到了同样的问题而且我使用了它并且它对我有用

    library(downloader)
    download("https://github.com/ropensci/plotly/archive/master.tar.gz", "plotly.tar.gz")
    install.packages("plotly.tar.gz", repos = NULL, type = "source")

答案 2 :(得分:2)

GitHub不再支持HTTP。这在几年前已被禁用,可能与mitigation of FireSheep一致。我的测试如下:

curl -i http://github.com/ggobi/cranvas/archive/master.zip
HTTP/1.1 301 Moved Permanently
Server: GitHub.com
Date: Mon, 26 Aug 2013 03:15:17 GMT
Content-Type: text/html
Content-Length: 178
Connection: close
Location: https://github.com/ggobi/cranvas/archive/master.zip
Vary: Accept-Encoding

<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>

请注意301和HTTPS作为替换网址。