我正在做一个生产项目,没有突然我不能建立网络应用程序,我可以建立只有两个星期前。
下面是完整的错误输出:
modestovascofornas@MacBook-Air-de-modesto capenergy_ns % flutter build web
💪 Building with sound null safety 💪
Target dart2js failed: Exception: Warning: The 'dart2js' entrypoint script is deprecated, please use 'dart compile js' instead.
Error: Error when reading
'file:///Volumes/ModesSSD#1/Proyectos%20en%20curso/Capenergy/2022_G3_CAPENERGY_NS/capenergy_ns/.dart_tool/flutter_build/d53138d5fdb7d0ae38b7d7e14
72afba3/main.dart': Unsupported operation: Cannot extract a file path from a URI with a fragment component
Error: No 'main' method found.
Error: Compilation failed.
#0 Dart2JSTarget.build (package:flutter_tools/src/build_system/targets/web.dart:225:7)
<asynchronous suspension>
#1 _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:847:9)
<asynchronous suspension>
#2 Future.wait.<anonymous closure> (dart:async/future.dart:522:21)
<asynchronous suspension>
#3 _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:785:32)
<asynchronous suspension>
#4 Future.wait.<anonymous closure> (dart:async/future.dart:522:21)
<asynchronous suspension>
#5 _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:785:32)
<asynchronous suspension>
#6 FlutterBuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:614:16)
<asynchronous suspension>
#7 buildWeb (package:flutter_tools/src/web/compile.dart:53:32)
<asynchronous suspension>
#8 BuildWebCommand.runCommand (package:flutter_tools/src/commands/build_web.dart:135:5)
<asynchronous suspension>
#9 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1257:27)
<asynchronous suspension>
#10 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#11 CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#12 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:283:9)
<asynchronous suspension>
#13 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#14 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
<asynchronous suspension>
#15 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:64:9)
<asynchronous suspension>
#16 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#17 main (package:flutter_tools/executable.dart:91:3)
<asynchronous suspension>
Compiling lib/main.dart for the Web... 216ms
Exception: Failed to compile application for the Web.
我能做些什么来解决这个问题?
1条答案
按热度按时间guykilcj1#
根据您提供的错误消息,似乎有两个问题导致Web应用无法成功生成:
dart2js
入口点脚本已弃用,您应改用dart compile js
。1.未找到“main”方法。
要解决第一个问题,您需要更新/修改您的构建命令
希望这能成功!