我创建了两个 R 包。
现在我处于需要package2
依赖的情况package1
。
在项目中package2
,我运行了这行代码:
usethis::use_dev_package(package = "package1", type = "Imports", remote = "gitlab::my_gitlab_name")
它将DESCRIPTION文件更新为以下内容:
Package: package2
Title: My Package title
Version: 0.0.0.9000
Authors@R:
person(given = "My",
family = "Name",
role = c("aut", "cre"),
email = "myname@myemail.com")
Description: My package does somethings.
License: file LICENSE
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.2
Imports:
data.table,
dplyr,
package1 (>= 0.0.0.9000)
Suggests:
testthat (>= 3.0.0)
Config/testthat/edition: 3
Remotes:
gitlab::my_gitlab_name
但是,当我尝试通过运行以下命令安装软件包时:
devtools::install()
我收到以下错误:
Error in utils::download.file(url, path, method = method, quiet = quiet, :
cannot open URL 'https://gitlab.com/api/v4/projects/my_gitlab_name%2Fpackage1/repository/commits/HEAD'
仅供参考,我也尝试了以下方法,但没有成功(无论如何我都会遇到同样的错误):
usethis::use_dev_package(package = "package1", type = "Imports", remote = "my_gitlab_name/package1")
usethis::use_dev_package(package = "package1", type = "Imports", remote = "my_gitlab_name")
usethis::use_dev_package(package = "package1", type = "Imports", remote = "my_gitlab_name/package1")
usethis::use_dev_package(package = "package1", type = "Imports", remote = "gitlab::my_gitlab_name/package1")
简而言之,我想知道如何添加 gitlab 开发人员库作为包的导入。
有谁知道我在这里想念什么?您的帮助将不胜感激。
我很抱歉没有提供一个可重复的例子,有问题的包都是我公司专有的。