I couldn't pub get a package from gitlab repository that contains two packages

Viewed 1073

version

Pub 2.11.0-174.0.dev

Steps to Reproduce

I forked a package published to dartpub. DartPub GitLab This package contains twilio_programmable_video and twilio_programmable_video_platform_interface. twilio_programmable_video depends on twilio_programmable_video_platform_interface in the repository by relative path. Tree is like this.

packages
    ├ packageA
        └ pubspec.yaml
    └ packageB
        └ pubspec.yaml

I rewrite pubspec.yaml as the following.

dependency_overrides:
  twilio_programmable_video_platform_interface:
    git:
      url: ssh://git@gitlab.com/myname/programmable-video.git
      ref: master
      path: programmable_video_platform_interface
  twilio_programmable_video:
    git:
      url: ssh://git@gitlab.com/myname/programmable-video.git
      ref: master
      path: programmable_video

Then I tried to flutter pub get and failed with the following error.

Error on line 17, column 11: Invalid description in the "twilio_programmable_video" pubspec on the "twilio_programmable_video_platform_interface" dependency: "../programmable_video_platform_interface" is a relative path, but this isn't a local pubspec.
   ╷
17 │     path: ../programmable_video_platform_interface
   │           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
pub get failed (65;    ╵)

My pubspec.yaml is wrong? Is there another way to write it correctly?

Expected results: flutter pub get finish successfully.

Actual results: An error occurred when flutter pub get.

Logs
$ flutter pub get


Error on line 17, column 11: Invalid description in the "twilio_programmable_video" pubspec on the "twilio_programmable_video_platform_interface" dependency: "../programmable_video_platform_interface" is a relative path, but this isn't a local pubspec.
   ╷
17 │     path: ../programmable_video_platform_interface
   │           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
pub get failed (65;    ╵)

Edit (2021-01-29 16:40:00)

I want to get a package from my gitlab repository. I tried to get with the following specification.

dependencies:
  flutter:
    sdk: flutter

  twilio_programmable_video_platform_interface:
    git:
      url: ssh://git@gitlab.com/myname/programmable-video.git
      ref: master
      path: programmable_video_platform_interface
  twilio_programmable_video:
    git:
      url: ssh://git@gitlab.com/myname/programmable-video.git
      ref: master
      path: programmable_video

But I got the same error.

Error on line 17, column 11: Invalid description in the "twilio_programmable_video" pubspec on the "twilio_programmable_video_platform_interface" dependency: "../programmable_video_platform_interface" is a relative path, but this isn't a local pubspec.
   ╷
17 │     path: ../programmable_video_platform_interface
   │           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
pub get failed (65;    ╵)
1 Answers

It looks like you are trying to override the package dependency in dependency overrides. If yes, you should provide the absolute/relative path of the twilio_programmable_video_platform_interface and twilio_programmable_video repos. If you want to directly use the github repos in your project, you need to specify them under dependencies and not under dependency_overrides.

Snippet from pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  built_value: ^7.1.0
  packageA:
    git:
      url: git@bitbucket.org:pkg/packageA.git
      ref: master
# Incase you want to override the above usage and instead use the repo on 
# your local machine, you can specify the path of the repo under 
# dependency_overrides.

dependency_overrides:
  analyzer: ^0.41.1
  packageA:
    path: /Users/nbm/Downloads/Projects/Flutter/pkg/packageA
Related