Description
I was running flutter build web --web-renderer html
. I would post on Flutter's issues, but the error messages say it's an error with the compiler and to post here.
Warnings during compilation
Target dart2js failed: ProcessException: Process exited abnormally:
../../../AppData/Local/Pub/Cache/hosted/pub.dev/go_router-9.1.1/lib/src/information_provider.dart:125:34:
Warning: Operand of null-aware operation '!' has type 'String' which excludes null.
location: routeInformation.location!,
^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/go_router-9.1.1/lib/src/parser.dart:87:50:
Warning: Operand of null-aware operation '!' has type 'String' which excludes null.
configuration.findMatch(routeInformation.location!, extra: state.extra);
Compiler crash
.dart_tool/flutter_build/49d81d521a48ddef28aae02d9dba2ea9/main.dart:
Internal Error: The compiler crashed when compiling this element.
The compiler is broken.
When compiling the above element, the compiler crashed. It is not
possible to tell if this is caused by a problem in your program or
not. Regardless, the compiler should not crash.
The Dart team would greatly appreciate if you would take a moment to
report this problem at http://dartbug.com/new.
Please include the following information:
* the name and version of your operating system,
* the Dart SDK build number (3.2.0-97.0.dev), and
* the entire message you see here (including the full stack trace
below as well as the source location above).
The compiler crashed: Crash when compiling:
Bad state: No element
#0 List.last (dart:core-patch/growable_array.dart:348:5)
#1 LateLowering._addToCurrentScope (package:compiler/src/kernel/transformations/late_lowering.dart:212:28)
#2 LateLowering._initializedVariableCell (package:compiler/src/kernel/transformations/late_lowering.dart:262:12)
#3 LateLowering._variableCell (package:compiler/src/kernel/transformations/late_lowering.dart:221:11)
#4 LateLowering.transformVariableDeclaration (package:compiler/src/kernel/transformations/late_lowering.dart:275:12)
#5 _Lowering.visitVariableDeclaration (package:compiler/src/kernel/transformations/lowering.dart:73:26)
#6 VariableDeclaration.accept (package:kernel/ast.dart:10532:43)
#7 Transformer.transform (package:kernel/visitor.dart:1773:17)
#8 Transformer.transformList (package:kernel/visitor.dart:1790:18)
#9 Block.transformChildren (package:kernel/ast.dart:9008:7)
#10 Transformer.defaultTreeNode (package:kernel/visitor.dart:1807:10)
#11 TreeVisitor.defaultStatement (package:kernel/visitor.dart:415:41)
#12 TreeVisitor.visitBlock (package:kernel/visitor.dart:420:31)
#13 Block.accept (package:kernel/ast.dart:8996:43)
#14 Transformer.transform (package:kernel/visitor.dart:1773:17)
#15 Transformer.transformList (package:kernel/visitor.dart:1790:18)
#16 Block.transformChildren (package:kernel/ast.dart:9008:7)
#17 Transformer.defaultTreeNode (package:kernel/visitor.dart:1807:10)
#18 TreeVisitor.defaultStatement (package:kernel/visitor.dart:415:41)
#19 TreeVisitor.visitBlock (package:kernel/visitor.dart:420:31)
#20 Block.accept (package:kernel/ast.dart:8996:43)
#21 Transformer.transform (package:kernel/visitor.dart:1773:17)
#22 ForInStatement.transformChildren (package:kernel/ast.dart:9531:14)
#23 _Lowering.visitForInStatement (package:compiler/src/kernel/transformations/lowering.dart:112:15)
#24 ForInStatement.accept (package:kernel/ast.dart:9512:43)
#25 Transformer.transform (package:kernel/visitor.dart:1773:17)
#26 Transformer.transformList (package:kernel/visitor.dart:1790:18)
#27 Block.transformChildren (package:kernel/ast.dart:9008:7)
#28 Transformer.defaultTreeNode (package:kernel/visitor.dart:1807:10)
#29 TreeVisitor.defaultStatement (package:kernel/visitor.dart:415:41)
#30 TreeVisitor.visitBlock (package:kernel/visitor.dart:420:31)
#31 Block.accept (package:kernel/ast.dart:8996:43)
#32 Transformer.transform (package:kernel/visitor.dart:1773:17)
#33 BlockExpression.transformChildren (package:kernel/ast.dart:8611:14)
#34 Transformer.defaultTreeNode (package:kernel/visitor.dart:1807:10)
#35 TreeVisitor.defaultExpression (package:kernel/visitor.dart:223:43)
#36 TreeVisitor.visitBlockExpression (package:kernel/visitor.dart:350:51)
#37 BlockExpression.accept (package:kernel/ast.dart:8597:44)
#38 Transformer.transform (package:kernel/visitor.dart:1773:17)
#39 FieldInitializer.transformChildren (package:kernel/ast.dart:3302:15)
#40 Transformer.defaultTreeNode (package:kernel/visitor.dart:1807:10)
#41 TreeVisitor.defaultInitializer (package:kernel/visitor.dart:487:45)
#42 TreeVisitor.visitFieldInitializer (package:kernel/visitor.dart:492:53)
#43 FieldInitializer.accept (package:kernel/ast.dart:3288:45)
#44 Transformer.transform (package:kernel/visitor.dart:1773:17)
#45 Transformer.transformList (package:kernel/visitor.dart:1790:18)
#46 Constructor.transformChildren (package:kernel/ast.dart:2579:7)
#47 Transformer.defaultTreeNode (package:kernel/visitor.dart:1807:10)
#48 TreeVisitor.defaultMember (package:kernel/visitor.dart:471:35)
#49 _Lowering.defaultMember (package:compiler/src/kernel/transformations/lowering.dart:44:18)
#50 TreeVisitor.visitConstructor (package:kernel/visitor.dart:473:43)
#51 Constructor.accept (package:kernel/ast.dart:2558:40)
#52 Transformer.transform (package:kernel/visitor.dart:1773:17)
#53 Transformer.transformList (package:kernel/visitor.dart:1790:18)
#54 Class.transformChildren (package:kernel/ast.dart:1479:7)
#55 Transformer.defaultTreeNode (package:kernel/visitor.dart:1807:10)
#56 TreeVisitor.visitClass (package:kernel/visitor.dart:480:31)
#57 Class.accept (package:kernel/ast.dart:1426:38)
#58 Transformer.transform (package:kernel/visitor.dart:1773:17)
#59 Transformer.transformList (package:kernel/visitor.dart:1790:18)
#60 Library.transformChildren (package:kernel/ast.dart:605:7)
#61 _Lowering.visitLibrary (package:compiler/src/kernel/transformations/lowering.dart:49:10)
#62 List.forEach (dart:core-patch/growable_array.dart:416:8)
#63 transformLibraries (package:compiler/src/kernel/transformations/lowering.dart:22:13)
#64 Dart2jsTarget.performModularTransformationsOnLibraries (package:compiler/src/kernel/dart2js_target.dart:181:14)
#65 KernelTarget.runBuildTransformations (package:front_end/src/fasta/kernel/kernel_target.dart:1559:19)
#66 KernelTarget.buildComponent.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:626:7)
<asynchronous suspension>
#67 withCrashReporting (package:front_end/src/fasta/crash.dart:133:12)
<asynchronous suspension>
#68 KernelTarget.buildComponent (package:front_end/src/fasta/kernel/kernel_target.dart:576:12)
<asynchronous suspension>
#69 _buildInternal (package:front_end/src/kernel_generator_impl.dart:210:19)
<asynchronous suspension>
#70 withCrashReporting (package:front_end/src/fasta/crash.dart:133:12)
<asynchronous suspension>
#71 compile.<anonymous closure> (package:front_end/src/api_unstable/dart2js.dart:198:37)
<asynchronous suspension>
#72 CompilerContext.clear (package:front_end/src/fasta/compiler_context.dart:139:3)
<asynchronous suspension>
#73 compile (package:front_end/src/api_unstable/dart2js.dart:196:36)
<asynchronous suspension>
#74 _loadFromSource (package:compiler/src/phase/load_kernel.dart:304:29)
<asynchronous suspension>
#75 run (package:compiler/src/phase/load_kernel.dart:414:36)
<asynchronous suspension>
#76 Compiler.loadKernel (package:compiler/src/compiler.dart:388:9)
<asynchronous suspension>
#77 Compiler.produceKernel (package:compiler/src/compiler.dart:395:36)
<asynchronous suspension>
#78 Compiler.runSequentialPhases (package:compiler/src/compiler.dart:711:20)
<asynchronous suspension>
#79 Compiler.runInternal.<anonymous closure> (package:compiler/src/compiler.dart:311:7)
<asynchronous suspension>
#80 Compiler.runInternal (package:compiler/src/compiler.dart:310:5)
<asynchronous suspension>
#81 Compiler.run.<anonymous closure> (package:compiler/src/compiler.dart:231:11)
<asynchronous suspension>
#82 compile.<anonymous closure> (package:compiler/compiler_api.dart:249:30)
<asynchronous suspension>
#83 compile.compilationDone (package:compiler/src/dart2js.dart:738:3)
<asynchronous suspension>
#84 main (package:compiler/src/dart2js.dart:1241:3)
<asynchronous suspension>
Command: C:\Users\Levi\flutter\bin\cache\dart-sdk\bin\dart.exe --disable-dart-dev C:\Users\Levi\flutter\bin\cache\dart-sdk\bin\snapshots\dart2js.dart.snapshot
--platform-binaries=C:\Users\Levi\flutter\bin\cache\flutter_web_sdk\kernel --invoker=flutter_tool -Ddart.vm.product=true -DFLUTTER_WEB_AUTO_DETECT=false
-DFLUTTER_WEB_USE_SKIA=false -DFLUTTER_WEB_CANVASKIT_URL=https://www.gstatic.com/flutter-canvaskit/f613b678245991e74839f201ecd3f22b75465813/ --native-null-assertions
--no-source-maps -o C:\Users\Levi\Coding\Flutter\chabad\.dart_tool\flutter_build\49d81d521a48ddef28aae02d9dba2ea9\app.dill --packages=.dart_tool/package_config.json --cfe-only
C:\Users\Levi\Coding\Flutter\chabad\.dart_tool\flutter_build\49d81d521a48ddef28aae02d9dba2ea9\main.dart
#0 RunResult.throwException (package:flutter_tools/src/base/process.dart:125:5)
#1 _DefaultProcessUtils.run (package:flutter_tools/src/base/process.dart:278:19)
<asynchronous suspension>
#2 Dart2JSTarget.build (package:flutter_tools/src/build_system/targets/web.dart:189:5)
<asynchronous suspension>
#3 _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:853:9)
<asynchronous suspension>
#4 Future.wait.<anonymous closure> (dart:async/future.dart:523:21)
<asynchronous suspension>
#5 _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:791:32)
<asynchronous suspension>
#6 Future.wait.<anonymous closure> (dart:async/future.dart:523:21)
<asynchronous suspension>
#7 _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:791:32)
<asynchronous suspension>
#8 FlutterBuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:620:16)
<asynchronous suspension>
#9 WebBuilder.buildWeb (package:flutter_tools/src/web/compile.dart:89:34)
<asynchronous suspension>
#10 BuildWebCommand.runCommand (package:flutter_tools/src/commands/build_web.dart:198:5)
<asynchronous suspension>
#11 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1323:27)
<asynchronous suspension>
#12 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#13 CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#14 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:339:9)
<asynchronous suspension>
#15 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#16 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:285:5)
<asynchronous suspension>
#17 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:115:9)
<asynchronous suspension>
#18 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#19 main (package:flutter_tools/executable.dart:90:3)
<asynchronous suspension>
Compiling lib\main.dart for the Web... 13.9s
Exception: Failed to compile application for the Web.
Flutter Doctor
What would you like me to do? flutter doctor -v
[✓] Flutter (Channel beta, 3.14.0-0.1.pre, on Microsoft Windows [Version 10.0.22621.2134],
locale en-US)
• Flutter version 3.14.0-0.1.pre on channel beta at C:\Users\Levi\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 120d54d33a (10 days ago), 2023-08-17 14:10:34 -0500
• Engine revision f613b67824
• Dart version 3.2.0 (build 3.2.0-42.1.beta)
• DevTools version 2.26.1
[✓] Windows Version (Installed version of Windows is version 10 or higher)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at C:\Users\Levi\AppData\Local\Android\sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: C:\Program Files\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[✓] Visual Studio - develop Windows apps (Visual Studio Build Tools 2022 17.7.1)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools
• Visual Studio Build Tools 2022 version 17.7.34009.444
• Windows 10 SDK version 10.0.22621.0
[✓] Android Studio (version 2022.3)
• Android Studio at C:\Program Files\Android Studio
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)
[✓] VS Code, 64-bit edition (version 1.81.1)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.70.0
[✓] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version
10.0.22621.2134]
• Chrome (web) • chrome • web-javascript • Google Chrome 116.0.5845.111
• Edge (web) • edge • web-javascript • Microsoft Edge 116.0.1938.62
[✓] Network resources
• All expected network resources are available.
• No issues found!
I am on Windows 11 build 22621.2134. The crash occurred on Flutter stable, beta, and master, up to Dart version 3.2.0-97.0.dev
.
I'm not sure how much of the code I can share so I will try to get an MVP
Update 1: Creating a new project with the same exact pubspec.yaml
AND pubspec.lock
does not crash. I am running flutter clean
before compiling and still getting the error, despite using the same version of Flutter/Dart on both projects
Update 2. Upgrading to the latest versions of all my packages did not help. Copying all the code under lib
to the new project broke the new project as well.