Closed RoarGronmo closed 2 months ago
Hi @RoarGronmo I checked this on my end but couldn't reproduce that error on Flutter beta channel.
I found that the error Mismatched anonymous define() module: () => CanvasKitInit
appeared on https://github.com/flutter/flutter/issues/146189 which has been fixed by https://github.com/flutter/flutter/pull/147736 and landed to beta channel but not on stable yet.
Run program in web on chrome
Can you share how do you run the program? Does this issue occur when running program from command line or IDE (Android Studio/VSCode)?
It is run from Android Studio "play button", have not tested from command line.
I tried on command line, Android Studio and VSCode but only saw this error instead:
TypeError: Cannot read properties of undefined (reading 'Symbol(_privateNames)')
Sometimes, it is:
TypeError: Cannot read properties of undefined (reading 'Colors')
This error seems to be https://github.com/flutter/flutter/issues/145410.
However, after I retry running app several times, app is displayed without error. Could you confirm this on your side, @RoarGronmo?
Adding "run" log here:
DwdsInjector seems to be the last line done.
Screenshot with console message:
Elements:
It seems pretty standard...
Attaching idea.log if it helps idea.log
Attaching a zip of the program also (just a plain ordinary template as created by clicking New flutter project
in android Studio)
empty_project.zip
As mentioned before, stable
seems OK, master
/main
has other issues now, so I had to abandone that one.
Beta contains this error, where web version of all my builds seems to fail with similar error, therefore the "proof-of-concept" using a empty_project
.
Trying new things which isn't covered by stable at the moment, so I don't want to rewind there either. I hope for a beta fix soon.
Cannot find any ovious reason why it fails..., but it seem to be bound to to some templated files for web.
I tried on command line, Android Studio and VSCode but only saw this error instead:
TypeError: Cannot read properties of undefined (reading 'Symbol(_privateNames)')
Sometimes, it is:
TypeError: Cannot read properties of undefined (reading 'Colors')
This error seems to be #145410.
However, after I retry running app several times, app is displayed without error. Could you confirm this on your side, @RoarGronmo?
Haven't tried generation by console yet, will do soon.
Unable to find a reasonable command line to build to debug for chrome in console.
What command line do you use ?
Here's my result using
flutter build web
to make a release build, but that won't help if I cannot run it in debug mode.
PS C:\FlutterProjects\empty_project> flutter build web
Font asset "CupertinoIcons.ttf" was tree-shaken, reducing it from 257628 to 1172 bytes (99.5% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 7760 bytes (99.5% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Compiling lib\main.dart for the Web... 41,1s
√ Built build\web
PS C:\FlutterProjects\empty_project>
As you see, nothing suspicius.
Dived into it... the error
is catched in line 143... but that doesn't tell me much:
...which is the generated code.
will try to compare those two channels, to see whats the difference...
will try to compare those two channels, to see whats the difference...
I see that I haven't the knowledge in .js to analyze the output files...
I throw the ball...
(I collapsed your output logs and the generated JS code on your comments since they are too long for others to catch the overview of the issue)
Thank you for doing more tests. I ran your given sample project above but still saw a similar error at my comment.
Per our triage policy, the issue can be closed if it's fixed on master/main channel. However, the behavior of this is quite confusing (couldn't reproduce this on beta channel on my side, and the fix for a similar error on https://github.com/flutter/flutter/issues/146189 has already landed on beta), I will keep this open for other's input.
NOTE !
This error still persists when upgrading to Flutter v3.24.0 stable !!
PS C:\FlutterProjects\empty_project> flutter upgrade --verify-only
Flutter is already up to date on channel stable
Flutter 3.24.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 80c2e84975 (7 days ago) • 2024-07-30 23:06:49 +0700
Engine • revision b8800d88be
Tools • Dart 3.5.0 • DevTools 2.37.2
PS C:\FlutterProjects\empty_project>
Flutter doctor:
PS C:\FlutterProjects\empty_project> flutter doctor -v
[√] Flutter (Channel stable, 3.24.0, on Microsoft Windows [Version 10.0.22631.3958], locale nb-NO)
• Flutter version 3.24.0 on channel stable at c:\Flutter\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 80c2e84975 (7 days ago), 2024-07-30 23:06:49 +0700
• Engine revision b8800d88be
• Dart version 3.5.0
• DevTools version 2.37.2
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
• Android SDK at C:\Users\roarg\AppData\Local\Android\Sdk
• Platform android-35, build-tools 35.0.0
• ANDROID_HOME = C:\Users\roarg\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android Studio\Android Studio 2024.1.1.11\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.10+0--11609105)
• 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 Community 2019 16.11.3)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.11.31702.278
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2023.1)
• Android Studio at C:\Program Files\Android Studio\Android Studio 2023.1.1.28
• 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.7+0-b2043.56-10550314)
[√] Android Studio (version 2023.2)
• Android Studio at C:\Program Files\Android Studio\Android Studio 2023.2.1.25
• 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.9+0--11185874)
[√] Android Studio (version 2023.3)
• Android Studio at C:\Program Files\Android Studio\Android Studio 2023.3.1.20
• 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.10+0--11572160)
[√] Android Studio (version 2024.1)
• Android Studio at C:\Program Files\Android Studio\Android Studio 2024.1.1.11
• 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.10+0--11609105)
[√] Android Studio (version 2024.1)
• Android Studio at C:\Program Files\Android Studio\Android Studio 2024.1.2.10
• 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.11+0--11852314)
[√] Connected device (4 available)
• SM G965F (mobile) • 23b3df780c0c7ece • android-arm64 • Android 10 (API 29)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22631.3958]
• Chrome (web) • chrome • web-javascript • Google Chrome 127.0.6533.89
• Edge (web) • edge • web-javascript • Microsoft Edge 127.0.2651.86
[√] Network resources
• All expected network resources are available.
• No issues found!
PS C:\FlutterProjects\empty_project>
But fortunately is still OK when switching to channel main.
PS C:\FlutterProjects\empty_project> flutter doctor -v
[√] Flutter (Channel main, 3.24.0-1.0.pre.476, on Microsoft Windows [Version 10.0.22631.3958], locale nb-NO)
• Flutter version 3.24.0-1.0.pre.476 on channel main at c:\Flutter\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 8329f67639 (67 minutes ago), 2024-08-06 15:35:28 -0400
• Engine revision aabd582e9c
• Dart version 3.6.0 (build 3.6.0-116.0.dev)
• DevTools version 2.38.0
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
• Android SDK at C:\Users\roarg\AppData\Local\Android\Sdk
• Platform android-35, build-tools 35.0.0
• ANDROID_HOME = C:\Users\roarg\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android Studio\Android Studio 2024.1.1.11\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.10+0--11609105)
• 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 Community 2019 16.11.3)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.11.31702.278
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2023.1)
• Android Studio at C:\Program Files\Android Studio\Android Studio 2023.1.1.28
• 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.7+0-b2043.56-10550314)
[√] Android Studio (version 2023.2)
• Android Studio at C:\Program Files\Android Studio\Android Studio 2023.2.1.25
• 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.9+0--11185874)
[√] Android Studio (version 2023.3)
• Android Studio at C:\Program Files\Android Studio\Android Studio 2023.3.1.20
• 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.10+0--11572160)
[√] Android Studio (version 2024.1)
• Android Studio at C:\Program Files\Android Studio\Android Studio 2024.1.1.11
• 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.10+0--11609105)
[√] Android Studio (version 2024.1)
• Android Studio at C:\Program Files\Android Studio\Android Studio 2024.1.2.10
• 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.11+0--11852314)
[√] Connected device (4 available)
• SM G965F (mobile) • 23b3df780c0c7ece • android-arm64 • Android 10 (API 29)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22631.3958]
• Chrome (web) • chrome • web-javascript • Google Chrome 127.0.6533.89
• Edge (web) • edge • web-javascript • Microsoft Edge 127.0.2651.86
[√] Network resources
• All expected network resources are available.
• No issues found!
PS C:\FlutterProjects\empty_project>
Beta channel is still in:
PS C:\FlutterProjects\empty_project> flutter doctor -v
[√] Flutter (Channel beta, 3.24.0-0.2.pre, on Microsoft Windows [Version 10.0.22631.3958], locale nb-NO)
• Flutter version 3.24.0-0.2.pre on channel beta at c:\Flutter\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7c6b7e9ca4 (8 days ago), 2024-07-30 14:26:44 +0700
• Engine revision 6e4deceb38
• Dart version 3.5.0 (build 3.5.0-323.2.beta)
• DevTools version 2.37.2
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
• Android SDK at C:\Users\roarg\AppData\Local\Android\Sdk
• Platform android-35, build-tools 35.0.0
• ANDROID_HOME = C:\Users\roarg\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android Studio\Android Studio 2024.1.1.11\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.10+0--11609105)
• 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 Community 2019 16.11.3)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.11.31702.278
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2023.1)
• Android Studio at C:\Program Files\Android Studio\Android Studio 2023.1.1.28
• 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.7+0-b2043.56-10550314)
[√] Android Studio (version 2023.2)
• Android Studio at C:\Program Files\Android Studio\Android Studio 2023.2.1.25
• 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.9+0--11185874)
[√] Android Studio (version 2023.3)
• Android Studio at C:\Program Files\Android Studio\Android Studio 2023.3.1.20
• 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.10+0--11572160)
[√] Android Studio (version 2024.1)
• Android Studio at C:\Program Files\Android Studio\Android Studio 2024.1.1.11
• 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.10+0--11609105)
[√] Android Studio (version 2024.1)
• Android Studio at C:\Program Files\Android Studio\Android Studio 2024.1.2.10
• 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.11+0--11852314)
[√] Connected device (4 available)
• SM G965F (mobile) • 23b3df780c0c7ece • android-arm64 • Android 10 (API 29)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22631.3958]
• Chrome (web) • chrome • web-javascript • Google Chrome 127.0.6533.89
• Edge (web) • edge • web-javascript • Microsoft Edge 127.0.2651.86
[√] Network resources
• All expected network resources are available.
• No issues found!
PS C:\FlutterProjects\empty_project>
and fails in the same matter as v3.24.0 (stable).
I encounter the same. When investigated further, it has something to do with require.js where there is a mismatch with CanvasKitInit. I'm not so familiar with *.js to comment much. I hope this helps.
Facing the same issue on 3.24 stable release. Web builds for us are straight up broken, it sometimes builds, but then uncaught exceptions start appearing on random interactions like tooltip on iconButton gets positionDependantBox as undefined in JS.
Sharing broken build console log screenshots.
Have reverted to 3.22 for now.
@ishaanbahal This issue is about Uncaught Error: Mismatched anonymous define() module: () => CanvasKitInit
while your error is not the same, looks like you hit https://github.com/flutter/flutter/issues/145410 as my result above. Please follow it for updates. (Please post in text format that is easier to read and investigate next time, thanks!)
After going through Flutter 3.24 release notes. I noticed this update:
[web] Change --web-renderer default from auto to canvaskit by @mdebbar in 149773
After i run it with, flutter run -d chrome --web-renderer auto, it now runs normally. Flutter 3.24 forces the web rendering to use CanvasKit on desktop browser, when it should be html. Using the auto would alternate between desktop and mobile browsers.
I used this on launch.json (in vs code).
{ "name": [PROJECT-NAME], "request": "launch", "type": "dart", "flutterMode": "debug", "args": [ "--web-renderer", "auto" ] },
We encountered the same problem on 3.24.0 stable. --web-renderer=auto also fixed for us.
Same issue here... after update to 3.24.0 app doesnt work anymore on browser. using "flutter run -d chrome --web-renderer auto" works as expected
More info, can confirm this happens on Flutter 3.24.0 on stock app from flutter create.
After refresh, sample app starts working, but attempts to relaunch result in broken app / red screen. Refreshing solves the problem, but the issue comes back when doing flutter run the next time:
flutter run -d chrome
Launching lib/main.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome... 8.5s
This app is linked to the debug service: ws://127.0.0.1:55506/9HK75w2OVTA=/ws
Debug service listening on ws://127.0.0.1:55506/9HK75w2OVTA=/ws
🔥 To hot restart changes while running, press "r" or "R".
For a more detailed help message, press "h". To quit, press "q".
A Dart VM Service on Chrome is available at: http://127.0.0.1:55506/9HK75w2OVTA=
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following JSNoSuchMethodError was thrown building MyApp(dirty):
TypeError: Cannot read properties of undefined (reading 'MaterialApp')
The relevant error-causing widget was:
MyApp MyApp:file:///Users/jesseezell/sample/lib/main.dart:4:16
When the exception was thrown, this was the stack:
packages/sample/main.dart 13:12 build
packages/flutter/src/widgets/framework.dart 5687:22 build
packages/flutter/src/widgets/framework.dart 5617:15 performRebuild
packages/flutter/src/widgets/framework.dart 5333:7 rebuild
packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild]
packages/flutter/src/widgets/framework.dart 5593:5 mount
packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget
packages/flutter/src/widgets/framework.dart 3963:18 updateChild
packages/flutter/src/widgets/framework.dart 5642:16 performRebuild
packages/flutter/src/widgets/framework.dart 5333:7 rebuild
packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild]
packages/flutter/src/widgets/framework.dart 5593:5 mount
packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget
packages/flutter/src/widgets/framework.dart 3963:18 updateChild
packages/flutter/src/widgets/framework.dart 5642:16 performRebuild
packages/flutter/src/widgets/framework.dart 5780:11 performRebuild
packages/flutter/src/widgets/framework.dart 5333:7 rebuild
packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild]
packages/flutter/src/widgets/framework.dart 5771:11 [_firstBuild]
packages/flutter/src/widgets/framework.dart 5593:5 mount
packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget
packages/flutter/src/widgets/framework.dart 3963:18 updateChild
packages/flutter/src/widgets/framework.dart 5642:16 performRebuild
packages/flutter/src/widgets/framework.dart 5333:7 rebuild
packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild]
packages/flutter/src/widgets/framework.dart 5593:5 mount
packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget
packages/flutter/src/widgets/framework.dart 3963:18 updateChild
packages/flutter/src/widgets/framework.dart 5642:16 performRebuild
packages/flutter/src/widgets/framework.dart 5780:11 performRebuild
packages/flutter/src/widgets/framework.dart 5333:7 rebuild
packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild]
packages/flutter/src/widgets/framework.dart 5771:11 [_firstBuild]
packages/flutter/src/widgets/framework.dart 5593:5 mount
packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget
packages/flutter/src/widgets/framework.dart 3963:18 updateChild
packages/flutter/src/widgets/framework.dart 5642:16 performRebuild
packages/flutter/src/widgets/framework.dart 5780:11 performRebuild
packages/flutter/src/widgets/framework.dart 5333:7 rebuild
packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild]
packages/flutter/src/widgets/framework.dart 5771:11 [_firstBuild]
packages/flutter/src/widgets/framework.dart 5593:5 mount
packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget
packages/flutter/src/widgets/framework.dart 3963:18 updateChild
packages/flutter/src/widgets/framework.dart 5642:16 performRebuild
packages/flutter/src/widgets/framework.dart 5333:7 rebuild
packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild]
packages/flutter/src/widgets/framework.dart 5593:5 mount
packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget
packages/flutter/src/widgets/framework.dart 3963:18 updateChild
packages/flutter/src/widgets/framework.dart 5642:16 performRebuild
packages/flutter/src/widgets/framework.dart 5780:11 performRebuild
packages/flutter/src/widgets/framework.dart 5333:7 rebuild
packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild]
packages/flutter/src/widgets/framework.dart 5771:11 [_firstBuild]
packages/flutter/src/widgets/framework.dart 5593:5 mount
packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget
packages/flutter/src/widgets/framework.dart 3963:18 updateChild
packages/flutter/src/widgets/framework.dart 5642:16 performRebuild
packages/flutter/src/widgets/framework.dart 5333:7 rebuild
packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild]
packages/flutter/src/widgets/framework.dart 5593:5 mount
packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget
packages/flutter/src/widgets/framework.dart 3963:18 updateChild
packages/flutter/src/widgets/framework.dart 5642:16 performRebuild
packages/flutter/src/widgets/framework.dart 5333:7 rebuild
packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild]
packages/flutter/src/widgets/framework.dart 5593:5 mount
packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget
packages/flutter/src/widgets/framework.dart 3963:18 updateChild
packages/flutter/src/widgets/view.dart 441:16 [_updateChild]
packages/flutter/src/widgets/view.dart 464:5 mount
packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget
packages/flutter/src/widgets/framework.dart 3963:18 updateChild
packages/flutter/src/widgets/framework.dart 5642:16 performRebuild
packages/flutter/src/widgets/framework.dart 5333:7 rebuild
packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild]
packages/flutter/src/widgets/framework.dart 5593:5 mount
packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget
packages/flutter/src/widgets/framework.dart 3963:18 updateChild
packages/flutter/src/widgets/framework.dart 5642:16 performRebuild
packages/flutter/src/widgets/framework.dart 5780:11 performRebuild
packages/flutter/src/widgets/framework.dart 5333:7 rebuild
packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild]
packages/flutter/src/widgets/framework.dart 5771:11 [_firstBuild]
packages/flutter/src/widgets/framework.dart 5593:5 mount
packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget
packages/flutter/src/widgets/framework.dart 3963:18 updateChild
packages/flutter/src/widgets/binding.dart 1605:16 [_rebuild]
packages/flutter/src/widgets/binding.dart 1574:5 mount
packages/flutter/src/widgets/binding.dart 1527:16 <fn>
packages/flutter/src/widgets/framework.dart 3038:11 buildScope
packages/flutter/src/widgets/binding.dart 1526:12 attach
packages/flutter/src/widgets/binding.dart 1265:26 attachToBuildOwner
packages/flutter/src/widgets/binding.dart 1247:5 attachRootWidget
packages/flutter/src/widgets/binding.dart 1233:7 <fn>
dart-sdk/lib/_internal/js_dev_runtime/private/isolate_helper.dart 48:11 internalCallback
════════════════════════════════════════════════════════════════════════════════════════════════════
With
flutter run -d chrome --web-renderer=canvaskit
This is reproducible consistently on first load with sample app, again refreshing makes it go away until next run.
Note that the require.js error also goes away with these flags when require.js is turned off:
flutter run -d chrome --web-renderer=canvaskit --extra-front-end-options=--dartdevc-module-format=ddc
I wonder if it's related to this commit that introduced dynamic loading via a script tag. Now this commit was in 3.22 as well, but maybe something in 3.24 has triggered it to surface the error:
https://github.com/flutter/flutter/commit/ee94fe262b63b0761e8e1f889ae52322fef068d2
Which require.js explicitly warns about in the docs about this error:
https://requirejs.org/docs/errors.html
To avoid the error:
Be sure to load all scripts that call define() via the RequireJS API. Do not manually code script tags in HTML to load scripts that have define() calls in them.
If you manually code an HTML script tag, be sure it only includes named modules, and that an anonymous module that will have the same name as one of the modules in that file is not loaded.
If the problem is the use of loader plugins or anonymous modules but the RequireJS optimizer is not used for file bundling, use the RequireJS optimizer.
If the problem is the var define lint approach, use /*global define */ (no space before "global") comment style instead.
More info, can confirm this happens on Flutter 3.24.0 on stock app from flutter create.
After refresh, sample app starts working, but attempts to relaunch result in broken app / red screen. Refreshing solves the problem, but the issue comes back when doing flutter run the next time:
flutter run -d chrome Launching lib/main.dart on Chrome in debug mode... Waiting for connection from debug service on Chrome... 8.5s This app is linked to the debug service: ws://127.0.0.1:55506/9HK75w2OVTA=/ws Debug service listening on ws://127.0.0.1:55506/9HK75w2OVTA=/ws 🔥 To hot restart changes while running, press "r" or "R". For a more detailed help message, press "h". To quit, press "q". A Dart VM Service on Chrome is available at: http://127.0.0.1:55506/9HK75w2OVTA= ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════ The following JSNoSuchMethodError was thrown building MyApp(dirty): TypeError: Cannot read properties of undefined (reading 'MaterialApp') The relevant error-causing widget was: MyApp MyApp:file:///Users/jesseezell/sample/lib/main.dart:4:16 When the exception was thrown, this was the stack: packages/sample/main.dart 13:12 build packages/flutter/src/widgets/framework.dart 5687:22 build packages/flutter/src/widgets/framework.dart 5617:15 performRebuild packages/flutter/src/widgets/framework.dart 5333:7 rebuild packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild] packages/flutter/src/widgets/framework.dart 5593:5 mount packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget packages/flutter/src/widgets/framework.dart 3963:18 updateChild packages/flutter/src/widgets/framework.dart 5642:16 performRebuild packages/flutter/src/widgets/framework.dart 5333:7 rebuild packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild] packages/flutter/src/widgets/framework.dart 5593:5 mount packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget packages/flutter/src/widgets/framework.dart 3963:18 updateChild packages/flutter/src/widgets/framework.dart 5642:16 performRebuild packages/flutter/src/widgets/framework.dart 5780:11 performRebuild packages/flutter/src/widgets/framework.dart 5333:7 rebuild packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild] packages/flutter/src/widgets/framework.dart 5771:11 [_firstBuild] packages/flutter/src/widgets/framework.dart 5593:5 mount packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget packages/flutter/src/widgets/framework.dart 3963:18 updateChild packages/flutter/src/widgets/framework.dart 5642:16 performRebuild packages/flutter/src/widgets/framework.dart 5333:7 rebuild packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild] packages/flutter/src/widgets/framework.dart 5593:5 mount packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget packages/flutter/src/widgets/framework.dart 3963:18 updateChild packages/flutter/src/widgets/framework.dart 5642:16 performRebuild packages/flutter/src/widgets/framework.dart 5780:11 performRebuild packages/flutter/src/widgets/framework.dart 5333:7 rebuild packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild] packages/flutter/src/widgets/framework.dart 5771:11 [_firstBuild] packages/flutter/src/widgets/framework.dart 5593:5 mount packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget packages/flutter/src/widgets/framework.dart 3963:18 updateChild packages/flutter/src/widgets/framework.dart 5642:16 performRebuild packages/flutter/src/widgets/framework.dart 5780:11 performRebuild packages/flutter/src/widgets/framework.dart 5333:7 rebuild packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild] packages/flutter/src/widgets/framework.dart 5771:11 [_firstBuild] packages/flutter/src/widgets/framework.dart 5593:5 mount packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget packages/flutter/src/widgets/framework.dart 3963:18 updateChild packages/flutter/src/widgets/framework.dart 5642:16 performRebuild packages/flutter/src/widgets/framework.dart 5333:7 rebuild packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild] packages/flutter/src/widgets/framework.dart 5593:5 mount packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget packages/flutter/src/widgets/framework.dart 3963:18 updateChild packages/flutter/src/widgets/framework.dart 5642:16 performRebuild packages/flutter/src/widgets/framework.dart 5780:11 performRebuild packages/flutter/src/widgets/framework.dart 5333:7 rebuild packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild] packages/flutter/src/widgets/framework.dart 5771:11 [_firstBuild] packages/flutter/src/widgets/framework.dart 5593:5 mount packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget packages/flutter/src/widgets/framework.dart 3963:18 updateChild packages/flutter/src/widgets/framework.dart 5642:16 performRebuild packages/flutter/src/widgets/framework.dart 5333:7 rebuild packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild] packages/flutter/src/widgets/framework.dart 5593:5 mount packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget packages/flutter/src/widgets/framework.dart 3963:18 updateChild packages/flutter/src/widgets/framework.dart 5642:16 performRebuild packages/flutter/src/widgets/framework.dart 5333:7 rebuild packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild] packages/flutter/src/widgets/framework.dart 5593:5 mount packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget packages/flutter/src/widgets/framework.dart 3963:18 updateChild packages/flutter/src/widgets/view.dart 441:16 [_updateChild] packages/flutter/src/widgets/view.dart 464:5 mount packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget packages/flutter/src/widgets/framework.dart 3963:18 updateChild packages/flutter/src/widgets/framework.dart 5642:16 performRebuild packages/flutter/src/widgets/framework.dart 5333:7 rebuild packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild] packages/flutter/src/widgets/framework.dart 5593:5 mount packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget packages/flutter/src/widgets/framework.dart 3963:18 updateChild packages/flutter/src/widgets/framework.dart 5642:16 performRebuild packages/flutter/src/widgets/framework.dart 5780:11 performRebuild packages/flutter/src/widgets/framework.dart 5333:7 rebuild packages/flutter/src/widgets/framework.dart 5599:5 [_firstBuild] packages/flutter/src/widgets/framework.dart 5771:11 [_firstBuild] packages/flutter/src/widgets/framework.dart 5593:5 mount packages/flutter/src/widgets/framework.dart 4468:15 inflateWidget packages/flutter/src/widgets/framework.dart 3963:18 updateChild packages/flutter/src/widgets/binding.dart 1605:16 [_rebuild] packages/flutter/src/widgets/binding.dart 1574:5 mount packages/flutter/src/widgets/binding.dart 1527:16 <fn> packages/flutter/src/widgets/framework.dart 3038:11 buildScope packages/flutter/src/widgets/binding.dart 1526:12 attach packages/flutter/src/widgets/binding.dart 1265:26 attachToBuildOwner packages/flutter/src/widgets/binding.dart 1247:5 attachRootWidget packages/flutter/src/widgets/binding.dart 1233:7 <fn> dart-sdk/lib/_internal/js_dev_runtime/private/isolate_helper.dart 48:11 internalCallback ════════════════════════════════════════════════════════════════════════════════════════════════════
Confirming your observation that a "plain refresh" reloads the app and then it starts.
hot reload (lightning) and refresh (play button) may reload app if it is running in chrome, but after you have done a "plain refresh".
same behavior on Microsoft Edge.
I think the title is misleading, the most severe part of the issue is that upgrading from old stable to new stable the issue occur w/o any "warning", "notified breaking change" or whatever
I think the title is misleading, the most severe part of the issue is that upgrading from old stable to new stable the issue occur w/o any "warning", "notified breaking change" or whatever
It was discovered when upgrading beta to the mentioned version before 3.24.0 was released. I agree that the title might be misleading now.
We upgraded yesterday from 3.22.0 to 3.24.0 and we also detected this error (stable channel)
I'm looking into this. So far what I found:
This PR: https://github.com/flutter/engine/pull/53718 fixes the issue. It's already listed in the CP list here: https://github.com/flutter/flutter/issues/152953 (cc @kevmoo)
Closing as fixed. Already tracked as a cherry pick to stable (3.24)
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v
and a minimal reproduction of the issue.
Steps to reproduce
require.js:143 Uncaught Error: Mismatched anonymous define() module: () => CanvasKitInit http://requirejs.org/docs/errors.html#mismatch at makeError (require.js:168:17) at intakeDefines (require.js:1254:36) at Object.localRequire [as require] (require.js:1446:21) at requirejs (require.js:1797:24) at req.config (require.js:1805:16) at main_module.bootstrap.js:3:9
[√] Flutter (Channel stable, 3.22.3, on Microsoft Windows [Version 10.0.22631.3958], locale nb-NO) • Flutter version 3.22.3 on channel stable at c:\Flutter\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision b0850beeb2 (3 weeks ago), 2024-07-16 21:43:41 -0700 • Engine revision 235db911ba • Dart version 3.4.4 • DevTools version 2.34.3
[√] Flutter (Channel main, 3.24.0-1.0.pre.438, on Microsoft Windows [Version 10.0.22631.3958], locale nb-NO) • Flutter version 3.24.0-1.0.pre.438 on channel main at c:\Flutter\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision cbfb222446 (18 hours ago), 2024-08-03 21:13:39 -0400 • Engine revision 16012e2f8c • Dart version 3.6.0 (build 3.6.0-114.0.dev) • DevTools version 2.38.0
Flutter Doctor output
Doctor output
```console PS C:\flutter> flutter doctor -v [√] Flutter (Channel beta, 3.24.0-0.2.pre, on Microsoft Windows [Version 10.0.22631.3958], locale nb-NO) • Flutter version 3.24.0-0.2.pre on channel beta at c:\Flutter\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 7c6b7e9ca4 (5 days ago), 2024-07-30 14:26:44 +0700 • Engine revision 6e4deceb38 • Dart version 3.5.0 (build 3.5.0-323.2.beta) • DevTools version 2.37.2 [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 35.0.0) • Android SDK at C:\Users\roarg\AppData\Local\Android\Sdk • Platform android-35, build-tools 35.0.0 • ANDROID_HOME = C:\Users\roarg\AppData\Local\Android\Sdk • Java binary at: C:\Program Files\Android Studio\Android Studio 2024.1.1.11\jbr\bin\java • Java version OpenJDK Runtime Environment (build 17.0.10+0--11609105) • 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 Community 2019 16.11.3) • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community • Visual Studio Community 2019 version 16.11.31702.278 • Windows 10 SDK version 10.0.19041.0 [√] Android Studio (version 2023.1) • Android Studio at C:\Program Files\Android Studio\Android Studio 2023.1.1.28 • 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.7+0-b2043.56-10550314) [√] Android Studio (version 2023.2) • Android Studio at C:\Program Files\Android Studio\Android Studio 2023.2.1.25 • 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.9+0--11185874) [√] Android Studio (version 2023.3) • Android Studio at C:\Program Files\Android Studio\Android Studio 2023.3.1.20 • 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.10+0--11572160) [√] Android Studio (version 2024.1) • Android Studio at C:\Program Files\Android Studio\Android Studio 2024.1.1.11 • 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.10+0--11609105) [√] Android Studio (version 2024.1) • Android Studio at C:\Program Files\Android Studio\Android Studio 2024.1.2.10 • 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.11+0--11852314) [√] Connected device (4 available) • SM G965F (mobile) • 23b3df780c0c7ece • android-arm64 • Android 10 (API 29) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22631.3958] • Chrome (web) • chrome • web-javascript • Google Chrome 127.0.6533.89 • Edge (web) • edge • web-javascript • Microsoft Edge 127.0.2651.86 [√] Network resources • All expected network resources are available. • No issues found! ```