1

I've created two R packages.

Now I'm in a situation in which I need package2 to rely on package1.

In the project for package2, I've run this line of code:

usethis::use_dev_package(package = "package1", type = "Imports", remote = "gitlab::my_gitlab_name")

which updates the DESCRIPTION file to read the following:

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

However, when I try to install the package by running this:

devtools::install()

I get the following error:

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'

FYI, I've also tried the following, with no success (I get the same error no matter what):

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")

In short, I'd like to know how to add a gitlab developer library as an import for a package.

Does anyone know what I'm missing here? Your help would be much appreciated.

My apologies for not providing a reproducible example, the packages in question are both proprietary to my company.

awags1
  • 304
  • 2
  • 8
  • If you check `sessionInfo()` what version of `remotes` are you using? It would be easier to help with a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). What is the exact user/repo that you are trying to access? Is the `%2F` part in your real error message? – MrFlick Dec 14 '21 at 20:02
  • Do you really get the exact same error message after trying all these different options? If not, be sure to include the appropriate error messages for each attempt. If the error doesn't change at all, that seems very suspicious. – MrFlick Dec 14 '21 at 20:08
  • Thanks for the quick response(s). I'm running `remotes_2.4.0`. Yes, I get the exact same error message regardless of the usethis::use_dev_package() information I've tried (of the options itemized in my question). It makes me suspect the issue is something other than what I'm trying in the DESCRIPTION. And yes, `%2F` is in my real error message. – awags1 Dec 14 '21 at 21:15
  • @MrFlick Let me know if you need anything else. The packages are internal to my company (and are on our company gitlab) so I really can't give access to provide a reproducible example. I recognize that makes answering difficult. – awags1 Dec 14 '21 at 21:35

0 Answers0