supabase / supabase-flutter

Flutter integration for Supabase. This package makes it simple for developers to build secure and scalable products.
https://supabase.com/
MIT License
737 stars 184 forks source link

A package may not list itself as a dependency #957

Closed pepie closed 4 months ago

pepie commented 4 months ago

Describe the bug supabase_flutter 2.5.6 fails, stating dependency for supabase 2.2.2. When "supabase 2.2.2" is added, installation fails with "A package may not list itself as a dependency".

Errors when using "supabase_flutter 2.5.6" only:

flutter pub get


So, because supabase is 1.0.0+1, version solving failed.

You can try the following suggestion to make the pubspec resolve:

When using 'supabase 2.5.6' and 'supabse 2.2.2' :

Error on line 35, column 3 of pubspec.yaml: A package may not list itself as a dependency.
   ╷
35 │   supabase: 2.2.2
   │   ^^^^^^^^

To Reproduce Steps to reproduce the behavior:

  1. Add supabase_flutter: ^2.5.6 to pubspec.yaml
  2. Run flutter pub get
  3. See error

Expected behavior Package install and flutter run completes successfully

Screenshot 2024-06-26 at 11 32 17 PM

Screenshots If applicable, add screenshots to help explain your problem.

Version (please complete the following information): On Linux/macOS Please run dart pub deps | grep -E "supabase|gotrue|postgrest|storage_client|realtime_client|functions_client" in your project directory and paste the output here.


So, because supabase is 1.0.0+1, version solving failed.

You can try the following suggestion to make the pubspec resolve:
* Consider downgrading your constraint on supabase_flutter: dart pub add supabase_flutter:^1.0.1```

On Windows
Please run `dart pub deps | findstr "supabase gotrue postgrest storage_client realtime_client functions_client"` in your project directory and paste the output here.

**Additional context**
Add any other context about the problem here.
dshukertjr commented 4 months ago

You probably have spuabase package as a dependency in your project. Remove it and you are good to go!

pepie commented 4 months ago

You probably have spuabase package as a dependency in your project. Remove it and you are good to go!

@dshukertjr See the updated ticket. When using 'supabase_flutter 2.5.6.' by itself, it complains that Because supabase depends on supabase_flutter ^2.5.6 which depends on supabase 2.2.2, supabase 2.2.2 is required

If I add 'supabase 2.2.2' then I get A package may not list itself as a dependency

Here's my full pubspec file:

[This one returned the first error - dependency on supabase 2.2.2]

description: "A new Flutter project."
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.0.0+1

environment:
  sdk: '>=3.4.3 <4.0.0'

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.6
  supabase_flutter: ^2.5.6

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^3.0.0

flutter:
  uses-material-design: true

[This version returns the second error - package may not list self as dependency]

description: "A new Flutter project."
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.0.0+1

environment:
  sdk: '>=3.4.3 <4.0.0'

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.6
  supabase: 2.2.2
  supabase_flutter: ^2.5.6

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^3.0.0

flutter:
  uses-material-design: true
pepie commented 4 months ago

I've ran "flutter clean" a few times already.

I also noticed that, running 'flutter pub add supabase_flutter' will install version 1.x and not the latest version (2.5.x)

dshukertjr commented 4 months ago

@pepie You probably messed up your pub cache. Try resetting it. https://dart.dev/tools/pub/cmd/pub-cache#clearing-the-global-system-cache

pepie commented 4 months ago

@dshukertjr I think this might be a bug with 2.5.6. I cleaned the cache and stil get the same error.

I ran the following commands, in order:

dart pub cache clean
flutter clean   (just to be redundant)
flutter pub get
flutter doctor

I still got the same errors as mentioned above.

I removed the packages from pubspec.yml and ranflutter pub get and everything worked fine.

I then installed the package from the command line, with flutter pub add supabase_flutter

This works, but the installed version is supabase_flutter: ^1.0.1 . I expected this to install the latest version (2.5.6)

dshukertjr commented 4 months ago

@pepie I can assure you it's not a bug on Supabase's end. Not sure what it is, but it has to do with your local settings. flutter pug add command will automatically install the latest stable version. If it's not, it most likely has to do with your local configuration or perhaps the Flutter version.

If you cannot figure out what is wrong, I might try removing Flutter and re-installing it.

pepie commented 4 months ago

I don't think it's my flutter installation. I don't experience this with other packages.

I just executed the following sequence in the same project, to test this issue:

% flutter pub add amplify_flutter Result: Installed amplify_flutter 2.1.0 - the latest package

% flutter pub add supabase Result: Because supabase depends on supabase, version solving failed.

% flutter pub add supabase_flutter Result: "supabase_flutter 1.0.1 (2.5.6 available) " ** Here, again, version 1.0.1 was instaleld when 2.5.6 is available

% flutter pub add uuid Result: installed uuid 4.4.0 (latest package)

% flutter pub add supabase:2.5.6 Result: "Because supabase depends on supabase, version solving failed."

It seems supabse is reference itself.

pepie commented 4 months ago

@dshukertjr I think I figured it . I named my test project 'supabase', which collided with the package name. This explains the self-referencing error.

I renamed the project 'supabase_test' and ran 'flutter pub add supabase_flutter'. Everything seems to work now

dshukertjr commented 4 months ago

😅