从 GitHub 导入 pubspec yaml 中的包,需要 pubspec.yaml 文件,该文件不在存储库中

问题描述 投票:0回答:3

我在 pubspec.yaml 文件中使用

flutter pub get
和存储库包时遇到问题。

dependencies:
  flutter:
    sdk: flutter

  flutter_stripe:
    git: 
      url: https://github.com/flutter-stripe/flutter_stripe.git
      ref: poc-use-expensive-androidview

按照提供的步骤进行操作https://dart.dev/tools/pub/dependency#git-packages

但是,我收到错误

Could not find a file named "pubspec.yaml" in https://github.com/flutter-stripe/flutter_stripe.git 7934151fefed73c6a22c253de3a1f1c9d46decc2.
pub get failed (1; Could not find a file named "pubspec.yaml" in https://github.com/flutter-stripe/flutter_stripe.git 7934151fefed73c6a22c253de3a1f1c9d46decc2.)

我不知道应该为存储库中不存在的 pubspec.yaml 添加什么内容。如果您使用

flutter pub add flutter_stripe
来调用该包,它就可以正常工作。

我被要求使用非官方分支的原因是因为包提供的字段之一无法正常工作,建议的解决方案是使用此分支。

flutter flutter-dependencies
3个回答
4
投票

抱歉,我的错,我不知道托管包的根不是最终路径。我需要添加包的路径,然后可以在 ./packages/stripe 中找到该路径。

flutter_stripe:
    git: 
      url: https://github.com/flutter-stripe/flutter_stripe.git
      ref: poc-use-expensive-androidview
      path: ./packages/stripe

对于任何和我有同样问题的人...或者也许我只是菜鸟


0
投票

如果你查看 git 项目的包,你可以看到不止一个包:https://github.com/flutter-stripe/flutter_stripe/tree/main/packages 您必须选择您需要的套餐。


0
投票

面临同样的问题,但我的项目没有任何 pubspec 文件。 该怎么办? 想要添加为 git 存储库的包 https://pub.dev/packages/twilio_chat_conversation

© www.soinside.com 2019 - 2024. All rights reserved.