build_runner failing to compile after analyzer upgrade to 0.39.9

Created on 3 Jun 2020  路  14Comments  路  Source: dart-lang/build

Hey there,

I'm running into failures compiling build_runner against analyzer 0.39.9, which was released this morning by the looks of it. Here is the error:

Failed to precompile build_runner:build_runner:
../../../../../../../../../.pub-cache/hosted/pub.dartlang.org/build_resolvers-1.3.9/lib/src/resolver.dart:340:10: Error: Method not found: 'SummaryBuilder'.
  return SummaryBuilder(sdkSources, sdk.context).build(
         ^^^^^^^^^^^^^^
pub finished with exit code 1

Thanks!

Version info:
build_runner: 5.20
build_resolvers: 1.3.9
dart --version: Dart VM version: 2.8.1 (stable) (Thu Apr 30 09:25:21 2020 +0200) on "macos_x64"

Most helpful comment

Try like this

dev_dependencies:
  ...
  build_resolvers: ^1.3.11
  ...

All 14 comments

same problem here

Failed to precompile build_runner:build_runner:
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/build_resolvers-1.3.9/lib/src/resolver.dart:340:10: Error: Method not found: 'SummaryBuilder'.  
  return SummaryBuilder(sdkSources, sdk.context).build(
         ^^^^^^^^^^^^^^
pub finished with exit code 1`

Yes we got a patch release of analyzer (0.39.10) which fixes the problem

Nice! Thanks

I got same error with the new version 0.39.13

Failed to precompile build_runner:build_runner: ../../../../.pub-cache/hosted/pub.dartlang.org/build_resolvers-1.3.9/lib/src/resolver.dart:340:10: Error: Method not found: 'SummaryBuilder'. return SummaryBuilder(sdkSources, sdk.context).build(

I am also getting this issue with 0.39.15 version:

Failed to precompile build_runner:graph_inspector:
../../.pub-cache/hosted/pub.dartlang.org/build_resolvers-1.3.7/lib/src/resolver.dart:343:10: Error: Method not found: 'SummaryBuilder'.
  return SummaryBuilder(sdkSources, sdk.context)
         ^^^^^^^^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/build_resolvers-1.3.7/lib/src/resolver.dart:332:7: Error: The setter 'useSummary' isn't defined for the class 'FolderBasedDartSdk'.
 - 'FolderBasedDartSdk' is from 'package:analyzer/src/dart/sdk/sdk.dart' ('../../.pub-cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/src/dart/sdk/sdk.dart').
Try correcting the name to the name of an existing setter, or defining a setter or field named 'useSummary'.
    ..useSummary = false
      ^^^^^^^^^^
Failed to precompile build_runner:build_runner:
../../.pub-cache/hosted/pub.dartlang.org/build_resolvers-1.3.7/lib/src/resolver.dart:343:10: Error: Method not found: 'SummaryBuilder'.
  return SummaryBuilder(sdkSources, sdk.context)
         ^^^^^^^^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/build_resolvers-1.3.7/lib/src/resolver.dart:332:7: Error: The setter 'useSummary' isn't defined for the class 'FolderBasedDartSdk'.
 - 'FolderBasedDartSdk' is from 'package:analyzer/src/dart/sdk/sdk.dart' ('../../.pub-cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/src/dart/sdk/sdk.dart').
Try correcting the name to the name of an existing setter, or defining a setter or field named 'useSummary'.
    ..useSummary = false
      ^^^^^^^^^^
pub finished with exit code 1

I followed up in the new issue that was filed https://github.com/dart-lang/build/issues/2764 - sorry I missed the previous followup comment here about the 0.39.13 version.

Note that the easiest fix here is to update your build_resolvers version to at least 1.3.10.

I followed up in the new issue that was filed #2764 - sorry I missed the previous followup comment here about the 0.39.13 version.

Note that the easiest fix here is to update your build_resolvers version to at least 1.3.10.

i have the same issue, however this fix isn't working for me

I followed up in the new issue that was filed #2764 - sorry I missed the previous followup comment here about the 0.39.13 version.
Note that the easiest fix here is to update your build_resolvers version to at least 1.3.10.

i have the same issue, however this fix isn't working for me

Did you run flutter packages pub upgrade?

Yes i did.

Try like this

dev_dependencies:
  ...
  build_resolvers: ^1.3.11
  ...

I had to move on quickly. i moved the files to a new flutter project and it worked

just run flutter packages pub upgrade

Try like this

dev_dependencies:
  ...
  build_resolvers: ^1.3.11
  ...

You actually only need to upgrade the build_runner. Overrides build_resolvers seems a hackish approach to me - because it's basically utilizing the lock feature to replace a sub-dependency of the build_runner to get it to work. Why not bump the version of the build_runner which is more intuitive for code readers?

For example, I bumped the used version from build_runner: ^1.7.4 to build_runner: ^1.10.2 under devDependencies solved the problem.

You might encounter another error depends on the dart_style version in your pubspec.lock:

Failed to precompile build_runner:build_runner:
../../Desktop/dev/flutter/.pub-cache/hosted/pub.dartlang.org/dart_style-1.3.3/lib/src/dart_formatter.dart:105:30: Error: Too many positional arguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
    scanner.configureFeatures(featureSet);

You can solve this either by flutter pub upgrade or explicitly declare dart_style: ^1.3.6 in devDependencies.

Was this page helpful?
0 / 5 - 0 ratings