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

build_runner failed after upgrading my flutter #1427

Closed
casontek opened this issue May 7, 2024 · 9 comments
Closed

build_runner failed after upgrading my flutter #1427

casontek opened this issue May 7, 2024 · 9 comments

Comments

@casontek
Copy link

casontek commented May 7, 2024

i am unable to generate my model file after upgrading my flutter and dart sdk

dart --version
Dart SDK version: 3.5.0-103.0.dev (dev) (Thu Apr 25 17:03:06 2024 -0700) on "macos_x64"

flutter --version
Flutter 3.22.0-18.0.pre.30 • channel master • https://github.com/flutter/flutter.git
Framework • revision 5f0628d335 (11 days ago) • 2024-04-26 02:23:26 -0400
Engine • revision d794580077
Tools • Dart 3.5.0 (build 3.5.0-103.0.dev) • DevTools 2.35.0-dev.8

pubspec.yaml

environment:
sdk: '>=3.3.0-273.0.dev <4.0.0'

dev_dependencies:
flutter_test:
sdk: flutter
bloc_test: ^9.1.3
build_runner: ^2.4.9
json_serializable: ^6.7.1

model object

import 'package:json_annotation/json_annotation.dart';

part 'p_user.g.dart';

@JsonSerializable()
class User {
String name;
String phone;
String state;
String country;
String address;

User({
this.name = '',
this.phone = '',
this.country = '',
this.address = ''
});

factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json);

Map<String, dynamic> toJson() => _$UserToJson(this);

}

Build Error

[INFO] Precompiling build script... completed, took 147ms
[SEVERE] Failed to precompile build script .dart_tool/build/entrypoint/build.dart.
This is likely caused by a misconfigured builder definition.

@dawid-niedzwiecki
Copy link

dawid-niedzwiecki commented Aug 8, 2024

Same issue here with Flutter 3.24.0 (latest stable release)

@piotrkovsy1331
Copy link

Sadly I'm facing the same issue.

@Szymon3125
Copy link

i have the same issue
full error message after running dart run build_runner build --delete-conflicting-outputs:

[INFO] Entrypoint:Generating build script...
[INFO] Entrypoint:Generating build script completed, took 145ms

[INFO] Bootstrap:Precompiling build script......
Could not find a command named "/Users/username/flutter/bin/cache/dart-sdk/bin/snapshots/frontend_server.dart.snapshot".

Usage: dart <command|dart-file> [arguments]

Global options:
-v, --verbose               Show additional command output.
    --version               Print the Dart SDK version.
    --enable-analytics      Enable analytics.
    --disable-analytics     Disable analytics.
    --suppress-analytics    Disallow analytics for this `dart *` run without changing the analytics configuration.
-h, --help                  Print this usage information.

Available commands:
  analyze    Analyze Dart code in a directory.
  compile    Compile Dart to various formats.
  create     Create a new Dart project.
  devtools   Open DevTools (optionally connecting to an existing application).
  doc        Generate API documentation for Dart projects.
  fix        Apply automated fixes to Dart source code.
  format     Idiomatically format Dart source code.
  info       Show diagnostic information about the installed tooling.
  pub        Work with packages.
  run        Run a Dart program.
  test       Run tests for a project.

Run "dart help <command>" for more information about a command.
See https://dart.dev/tools/dart-tool for detailed documentation.
[INFO] Bootstrap:Precompiling build script... completed, took 121ms

[SEVERE] Bootstrap:
Failed to precompile build script .dart_tool/build/entrypoint/build.dart.
This is likely caused by a misconfigured builder definition.

@kevmoo
Copy link
Collaborator

kevmoo commented Aug 8, 2024

have you tried running dart pub upgrade?

@jakemac53
Copy link
Collaborator

You need the latest frontend_server_client package (this is a transitive dependency). Running dart pub upgrade (or flutter pub upgrade) should do the trick.

@robot-den
Copy link

robot-den commented Aug 23, 2024

dart pub upgrade helped.

I will write our error, so after search indexing some devs finds this page faster

Error: No named parameter with the name 'isNonNullableByDefault'
Context: Found this candidate, but the arguments don't match.

@kevmoo
Copy link
Collaborator

kevmoo commented Aug 25, 2024

Very thoughtful, @robot-den !! 🙏

github-merge-queue bot pushed a commit to SharezoneApp/sharezone-app that referenced this issue Oct 5, 2024
We couldn't run `dart run build_runner build` anymore. After executing
this command, you received:

```
[SEVERE] Failed to spawn build script after retry. This is likely due to a misconfigured builder definition. See the generated script at .dart_tool/build/entrypoint/build.dart to find errors.
```

This issue was introduced with
#1703. The reason for
it was that we need a newer `frontend_server_client` version (see
google/json_serializable.dart#1427 (comment)).

After running `dart/flutter pub upgrade` in every package, I was able to
execute `dart run build_runner build` again.
github-merge-queue bot pushed a commit to SharezoneApp/sharezone-app that referenced this issue Oct 10, 2024
We couldn't run `dart run build_runner build` anymore. After executing
this command, you received:

```
[SEVERE] Failed to spawn build script after retry. This is likely due to a misconfigured builder definition. See the generated script at .dart_tool/build/entrypoint/build.dart to find errors.
```

This issue was introduced with
#1703. The reason for
it was that we need a newer `frontend_server_client` version (see
google/json_serializable.dart#1427 (comment)).

After running `dart/flutter pub upgrade` in every package, I was able to
execute `dart run build_runner build` again.
@ROD-MASAMI
Copy link

@robot-den God bless you

@FullStackMusa
Copy link

have you tried running dart pub upgrade?

Work for me, Thanks @kevmoo 👏

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

9 participants