【问题标题】:error installing package on a branch with install_github使用 install_github 在分支上安装包时出错
【发布时间】:2017-05-28 03:25:58
【问题描述】:

我从 github 分叉了一个包,做了一些更改。我正在尝试安装已使用 install_github() 进行更改的软件包版本,但收到一条错误消息。有什么建议吗?

分叉版本:https://github.com/embruna/refnet

分支上的编辑版本:https://github.com/embruna/refnet/tree/proposed-updates

我可以安装分叉版本:

install_github("embruna/refnet", subdir="pkg")

我尝试在分支上安装以下版本:

install_github("embruna/refnet@proposed-updates", subdir="pkg")

然后得到这个错误:

** help
*** installing help indices
** building package indices
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  : 
    line 1 did not have 6 elements
ERROR: installing package indices failed
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/refnet’
Error: Command failed (1)

感谢您的任何建议。

编辑:有两个问题:1)我使用的 install_github 语法不正确,2)“pkg”中有一个文件夹,即使在更正语法后仍然抛出错误。详情见下文。

【问题讨论】:

  • install_github 调用中使用ref 似乎可以解决这个问题。像这样:install_github("repourl",ref="branch").

标签: github installation devtools


【解决方案1】:

我猜想用@ 指定分支,但用subdir 参数指定子目录会混淆devtools

这对我有用(在 repo 参数中指定子目录和分支):

install_github("embruna/refnet/pkg@proposed-updates",

这样做(将分支和子目录都指定为单独的参数):

devtools::install_github("embruna/refnet",
           ref = "proposed-updates", subdir = "pkg")

输出以这种方式开始...

Using GitHub PAT from envvar GITHUB_PAT
Downloading GitHub repo embruna/refnet@proposed-updates
from URL https://api.github.com/repos/embruna/refnet/zipball/proposed-updates
Installing refnet

这是使用 devtools 1.12.0

【讨论】:

  • 谢谢 Ben - 这两个对我来说都失败了,并且回退了原始问题中的错误。也使用 devtools 1.12.0
  • 以下对我有用:install_github("embruna/refnet/pkg", ref="proposed-updates") 但我最近从 GitHub API 看到了很多服务器错误 (500),这可能会导致您的问题。
  • 我认为这里有一个层次结构。 "embruna/refnet/pkg" + ref="proposed-updates" 有效(因为我们将前三个元素一起指定然后添加 ref),"embruna/refnet/pkg@proposed-updates" 也是如此,subdir=..., ref=... 也是如此,但 "embruna/refnet@proposed-updates"subdir=... 出现故障跨度>
  • 阿甘回来了!嘿,阿甘……我想通了。我创建了一个包含一些示例数据集的文件夹,并将其包含在“pkg”文件夹中。一旦我删除它,我就可以使用 Ben 的选项从分支安装,没有任何问题。
  • @BenBolker - 我的解释 + 接受你的解决方案一定是彼此错过了。
【解决方案2】:

我能够通过以下方式安装您的 proposed-updates 分支:

install_github("embruna/refnet", branch = "proposed-updates", subdir = "pkg")

我收到一堆警告,但没有错误消息。

【讨论】:

  • 我试过了,但还是没有运气……它仍然安装了原版。这两个命令在开始安装时都会返回以下内容:Downloading GitHub repo embruna/refnet@master 查看代码确认它正在安装原始的分叉版本。谢谢卡拉,会继续努力的。
猜你喜欢
  • 2015-08-16
  • 2018-05-02
  • 2017-02-21
  • 2015-03-01
  • 1970-01-01
  • 2018-11-11
  • 1970-01-01
  • 2019-04-04
  • 2018-09-11
相关资源
最近更新 更多