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

flutter packages pub run build_runner build failed to generate xxx.g.part file to parse json. #2758

Closed
sinojelly opened this issue Jul 17, 2020 · 2 comments

Comments

@sinojelly
Copy link

sinojelly commented Jul 17, 2020

  • Dart SDK Version (dart --version)

dart --version
Dart VM version: 2.9.0-14.1.beta (beta) (Tue Jun 9 10:52:57 2020 +0200) on "windows_x64"

  • What package(s) from this repo you are using, and the version (i.e. build_runner 0.7.12)

    • If you are not sure, try checking your pubspec.lock file.
      build_runner:
      dependency: "direct dev"
      description:
      name: build_runner
      url: "https://pub.flutter-io.cn"
      source: hosted
      version: "1.10.0"
      build_runner_core:
      dependency: transitive
      description:
      name: build_runner_core
      url: "https://pub.flutter-io.cn"
      source: hosted
      version: "5.2.0"
  • What builder(s) you are using (or writing yourself). Try to give a short summary of what they do.

  • Use Windows

d>flutter packages pub run build_runner build
[INFO] Generating build script...
[INFO] Generating build script completed, took 382ms

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

NoSuchMethodError: Closure call with mismatched arguments: function 'MutablePackageTree.allPackages'
Receiver: Closure: (_SyncIterator) => bool
Tried calling: MutablePackageTree.allPackages()
Found: MutablePackageTree.allPackages(_SyncIterator) => bool
dart:core _SyncIterable.iterator
package:package_config/src/package_config_impl.dart 26:36 new SimplePackageConfig
package:package_config/src/package_config_json.dart 213:10 parsePackageConfigJson
package:package_config/src/package_config_json.dart 45:10 parsePackageConfigBytes
package:package_config/src/package_config_io.dart 117:10 readPackageConfigJsonFile
package:package_config/src/discovery.dart 109:18 findPackagConfigInDirectory
package:package_config/src/discovery.dart 44:31 findPackageConfig
package:package_config/package_config.dart 114:5 findPackageConfig
package:build_runner_core/src/package_graph/package_graph.dart 74:15 PackageGraph.forPath
package:build_runner_core/src/package_graph/package_graph.dart 110:20 PackageGraph.forThisPackage
package:build_runner/src/entrypoint/run.dart 22:64 run
.dart_tool\build\entrypoint\build.dart 22:22 main

pub finished with exit code 1

If I switch to flutter stable channel, it shows the following error:

d>flutter --version
Flutter 1.17.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8af6b2f038 (2 weeks ago) • 2020-06-30 12:53:55 -0700
Engine • revision ee76268252
Tools • Dart 2.8.4

d>flutter packages pub run build_runner build
[INFO] Generating build script...
Unhandled exception:
NoSuchMethodError: The getter 'name' was called on null.
Receiver: null
Tried calling: name
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
#1 _findBuilderApplications. (package:build_runner/src/build_script_generate/build_script_generate.dart:63:24)
#2 _CustomHashMap.[]= (dart:collection-patch/collection_patch.dart:278:31)
#3 stronglyConnectedComponents.strongConnect (package:graphs/src/strongly_connected_components.dart:49:12)
#4 stronglyConnectedComponents.strongConnect (package:graphs/src/strongly_connected_components.dart:57:22)
#5 stronglyConnectedComponents.strongConnect (package:graphs/src/strongly_connected_components.dart:57:22)
#6 stronglyConnectedComponents (package:graphs/src/strongly_connected_components.dart:76:50)
#7 _findBuilderApplications (package:build_runner/src/build_script_generate/build_script_generate.dart:59:27)

#8 _generateBuildScript (package:build_runner/src/build_script_generate/build_script_generate.dart:28:26)
#9 logTimedAsync (package:build_runner_core/src/logging/logging.dart:25:30)
#10 generateBuildScript (package:build_runner/src/build_script_generate/build_script_generate.dart:25:5)
#11 generateAndRun (package:build_runner/src/build_script_generate/bootstrap.dart:49:31)

#12 main (file:///C:/Users/jelly/AppData/Roaming/Pub/Cache/hosted/pub.flutter-io.cn/build_runner-1.10.0/bin/build_runner.dart:87:30)

#13 _startIsolate. (dart:isolate-patch/isolate_patch.dart:299:32)
#14 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
pub finished with exit code 255

@jakemac53
Copy link
Contributor

This is caused by dart-lang/sdk#41802

You will need to delete your .dart_tool directory to resolve it.

@jakemac53
Copy link
Contributor

(or I think you can do a flutter clean)

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

2 participants