Build: Error running build

Created on 29 Mar 2018  路  7Comments  路  Source: dart-lang/build

  • Windows
  • Dart SDK Version: 2.0.0-dev.35.flutter-290c576264

pubspec:

dependencies:
  flutter:
    sdk: flutter

  # include Cupertino icons via the CupertinoIcons class
  cupertino_icons: "^0.1.0"

  built_collection: "^3.0.5"
  built_value: "^5.2.1"
  quiver: "^0.28.0"
  intl: "^0.15.2"
  flutter_redux: "^0.3.5"

dev_dependencies:
  flutter_test:
    sdk: flutter

  mockito: "^2.2.1"

  build_runner: ^0.8.0
  built_value_generator: ^5.2.1

I'm running as follows:

flutter packages pub run build_runner build

This was working fine until today. Earlier is was faffing about with brokenness due to the Dart 2.0 transition. After much pain, I eventually deleted my flutter install and reinstalled it, after which I could finally build and run my application again.

But now I can't run build because I get:

> flutter packages pub run build_runner build
[INFO] Generating build script...
[INFO] Generating build script completed, took 583ms
[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 536ms
[INFO] Checking for unexpected pre-existing outputs....
[INFO] Found 7 declared outputs which already exist on disk. This is likely because the`.dart_tool/build` folder was deleted, or you are submitting generated files to your source repository.


You have hit a bug in build_runner
Please file an issue with reproduction steps at https://github.com/dart-lang/build/issues


UnexpectedExistingOutputsException: Either you opted not to delete existing files, or you are not running in interactive mode and did not specify `deleteFilesByDefault` as `true`.

Found 7 outputs already on disk:

<<redacted>>|lib/dtos.g.dart
<<redacted>>|lib/features/login/dtos.g.dart
<<redacted>>|lib/features/login/state.g.dart
<<redacted>>|lib/features/timesheet/dtos.g.dart
<<redacted>>|lib/features/timesheet/state.g.dart
<<redacted>>|lib/state.g.dart
<<redacted>>|lib/utility/predicted.g.dart

package:build_runner/src/generate/build_definition.dart 440:9   _Loader._initialBuildCleanup
package:build_runner/src/generate/build_definition.dart 130:17  _Loader.prepareWorkspace.<fn>
package:build_runner/src/logging/logging.dart 26:30             logTimedAsync
package:build_runner/src/generate/build_definition.dart 127:13  _Loader.prepareWorkspace
package:build_runner/src/generate/build_definition.dart 65:12   BuildDefinition.prepareWorkspace
package:build_runner/src/generate/build_impl.dart 104:29        singleBuild
package:build_runner/src/generate/build_impl.dart 94:22         build
package:build_runner/src/generate/build.dart 66:5               build
package:build_runner/src/entrypoint/options.dart 274:24         _BuildCommand.run
package:args/command_runner.dart 194:27                         CommandRunner.runCommand
package:args/command_runner.dart 109:29                         CommandRunner.run.<fn>
dart:async                                                      new Future.sync
package:args/command_runner.dart 109:11                         CommandRunner.run
package:build_runner/src/entrypoint/run.dart 15:24              run
.dart_tool\build\entrypoint\build.dart 11:22                    main

pub finished with exit code 1

The error does not provide any guidance on how to rectify the situation. Presumably, deleting those files would work, but I hardly want to have to do that every time I need to regenerate source.

I tried digging through the code and found a --delete-conflicting-outputs parameter, but it looks to me like it is set by default. Moreover, I couldn't find a way to explicitly set it.

Can anyone point me in the right direction here?

build_runner needs info bug

Most helpful comment

found a --delete-conflicting-outputs parameter, but it looks to me like it is set by default

I think this is false by default. You should be able to pass it it as an argument to the build command. flutter packages pub run build_runner build --delete-conflicting-outputs

I suspect that something about how flutter packages works make this look like we don't have a TTY.

All 7 comments

/cc @natebosch

found a --delete-conflicting-outputs parameter, but it looks to me like it is set by default

I think this is false by default. You should be able to pass it it as an argument to the build command. flutter packages pub run build_runner build --delete-conflicting-outputs

I suspect that something about how flutter packages works make this look like we don't have a TTY.

@natebosch thanks, that works.

Can I suggest improving the error message when running the tool from the CLI? It should instead point users towards the --delete-conflicting-outputs option.

Yeah I'm keeping this issue open to improve the error message

Looks like we resolved this, I now get a severe log with a better message and not a stack trace.

Hi guys! I had the same issue. And it was solved by running the flutter packages pub run build_runner build --delete-conflicting-outputs command. But after that when I try to run the flutter packages pub run build_runner build again, I didn't get any outputs. Yet, the status is succeeded--with no outputs. All of my already-generated-files were gone and now I had no idea. I have tried to delete the .dart_tool to generate it again, but it still doesn't work, I still get the succeeded with no outputs.

can anyone help me please tell me what was happening and how to solve it?

I have found the answer. It was because I forgot to insert json_serializable on my dependencies.

Was this page helpful?
0 / 5 - 0 ratings