Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fresh installation of build_runner throws arbitrary errors #3791

Closed
AndreasMaitaGebit opened this issue Jan 3, 2025 · 5 comments
Closed

Comments

@AndreasMaitaGebit
Copy link

AndreasMaitaGebit commented Jan 3, 2025

Dear build_runner Team,

first, thank you for your contributions and for this amazing project you have been building on.

Unfortunately, I have not been able to use the build_runner in my freshly created flutter project. There seems to be an issue with the installation.

  • Dart SDK Version

    • 3.6.0
  • What package(s) from this repo you are using, and the version
    build_runner 2.4.14

  • What builder(s) you are using (or writing yourself). Try to give a short summary of what they do.
    the freezed package

  • Whether you are using Windows, MacOSX, or Linux (if applicable)
    im using MacOS

Steps to Reproduce:

  1. create a flutter project called shelf
    flutter create shelf

  2. add build_runner as a dev dependency
    dart pub add dev:build_runner

  3. get dependencies
    dart pub get

  4. run the build_runner just to check if installation was successful
    dart run build_runner build

Expected Behavior:

Nothing should happen, since no build steps are added and no other package is present

Actual Behavior:

dart build_runner build fails with a bunch of errors, i appended a file with the errors.
output.txt

What I already tried:

  • checking out the build repo, building it locally and using my local build_runner that i imported into my project via path dependency
  • clearing my pub cache
  • using older versions of build_runner
@jakemac53
Copy link
Contributor

I believe the issue is that you called your package shelf, but there is already a package with that name that build_runner depends on.

I would have expected some sort of version solve error but maybe pub has some slightly weird behavior in this case where the root package has the same name as a transitive (or regular) dependency?

@jakemac53
Copy link
Contributor

cc @jonasfj @sigurdm

@jakemac53
Copy link
Contributor

I am going to close this issue because I don't believe there is anything to do, but a new issue might need to be opened. Although I am not sure that pub can really do anything to recognize this situation.

@sigurdm
Copy link
Contributor

sigurdm commented Jan 7, 2025

Yeah - this corresponds to the case where you want to develop a local version of shelf. The root package takes precedence over the hosted one.

This is not new behavior, but has become a lot more relevant after workspaces, where packages in a workspace depend on each other, and when developing you resolve to the local version, but when depending on the hosted package you get a hosted transitive dependency.

It is unfortunate - but I'm not sure how we can solve it.

Maybe some kind of message on pub get could help (like you get for overridden packages). Not sure exactly how the rule should be...

@AndreasMaitaGebit
Copy link
Author

How unfortunate that my application is called shelf... ill try with a new name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants