gpt4 book ai didi

flutter - 如何修复 “Failed to snapshot build script”

转载 作者:行者123 更新时间:2023-12-03 04:16:01 29 4
gpt4 key购买 nike

我为Web和Dart SDK安装了Flutter。添加到路径bin文件夹。跑oji​​t_code和flutter pub global activate webdev,但是输入flutter pub upgrade后,我总是报错”:

[SEVERE] Failed to snapshot build script .dart_tool/build/entrypoint/build.dart.
[SEVERE] This is likely caused by a misconfigured builder definition.
[SEVERE] /C:/flutter/.pub-cache/hosted/pub.dartlang.org/protobuf-0.13.16/lib/src/protobuf/builder_info.dart:43:34: Error: Method not found: 'MapFieldInfo.map'. _addField(MapFieldInfo<K, V>.map(name, tagNumber, index, PbFieldType.M, ^^^/C:/flutter/.pub-cache/hosted/pub.dartlang.org/protobuf-0.13.16/lib/src/protobuf/field_info.dart:45:9: Error: '_mapEntryBuilderInfo' isn't an instance field of this class. _mapEntryBuilderInfo = null { ^^^^^^^^^^^^^^^^^^^^/C:/flutter/.pub-cache/hosted/pub.dartlang.org/protobuf-0.13.16/lib/src/protobuf/field_info.dart:61:9: Error: '_mapEntryBuilderInfo' isn't an instance field of this class. _mapEntryBuilderInfo = null; ^^^^^^^^^^^^^^^^^^^^/C:/flutter/.pub-cache/hosted/pub.dartlang.org/protobuf-0.13.16/lib/src/protobuf/field_info.dart:68:9: Error: '_mapEntryBuilderInfo' isn't an instance field of this class. _mapEntryBuilderInfo = null { ^^^^^^^^^^^^^^^^^^^^/C:/flutter/.pub-cache/hosted/pub.dartlang.org/protobuf-0.13.16/lib/src/protobuf/field_info.dart:82:12: Error: '_mapEntryBuilderInfo' isn't an instance field of this class. this._mapEntryBuilderInfo]) ^^^^^^^^^^^^^^^^^^^^/C:/flutter/.pub-cache/hosted/pub.dartlang.org/protobuf-0.13.16/lib/src/protobuf/field_info.dart:199:9: Error: Superclass has no constructor named 'FieldInfo._'. : super._( ^^^^^/C:/flutter/.pub-cache/hosted/pub.dartlang.org/protobuf-0.13.16/lib/src/protobuf/field_info.dart:195:21: Error: Final field '_mapEntryBuilderInfo' is not initialized.Try to#7 _CommandRunner.runCommand (package:webdev/src/webdev_command_runner.dart:38:24)
<asynchronous suspension>
#8 CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:112:25)
#9 new Future.sync (dart:async/future.dart:224:31)
#10 CommandRunner.run (package:args/command_runner.dart:112:14)
#11 run (package:webdev/src/webdev_command_runner.dart:19:56)
#12 main (file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/webdev-2.5.1/bin/webdev.dart:17:22)
<asynchronous suspension>
#13 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:303:32)
#14 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)

flutter 医生:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.9.1+hotfix.2, on Microsoft Windows [Version 10.0.18362.356], locale ru-RU)
[X] Android toolchain - develop for Android devices
X Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/setup/#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, set ANDROID_HOME to that location.
You may also want to add it to your PATH environment variable.

[!] Android Studio (not installed)
[√] VS Code (version 1.38.1)
[!] Connected device
! No devices available

! Doctor found issues in 3 categories.

pubspec.yaml:
name: addd
description: An app built using Flutter for web

environment:
# You must be using Flutter >=1.5.0 or Dart >=2.3.0
sdk: '>=2.3.0 <3.0.0'

dependencies:
flutter_web: any
flutter_web_ui: any

dev_dependencies:
build_runner: ^1.5.0
build_web_compilers: ^2.1.0
pedantic: ^1.7.0

dependency_overrides:
flutter_web:
git:
url: https://github.com/flutter/flutter_web
path: packages/flutter_web
flutter_web_ui:
git:
url: https://github.com/flutter/flutter_web
path: packages/flutter_web_ui

如何解决?

UPD。添加了更多详细信息(Flutter Doctor和pubspec.yaml)

最佳答案

嗨,我今天也遇到了同样的问题。通过运气和与正常工作的版本进行比较,我发现它被protobuf版本> 0.13.15破坏了。

短期修复:

在依赖性下的pubspec.yaml中,将protobuf的版本降级为0.13.15:

dependencies:
protobuf: <=0.13.15

正常运行 pub get然后运行 webdev serve

关于flutter - 如何修复 “Failed to snapshot build script”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57904930/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com