flutter_sound icon indicating copy to clipboard operation
flutter_sound copied to clipboard

[HELP]: MISMATCHED ANONYMOUS DEFINE() MODULES ERROR

Open kareem-darwinz opened this issue 3 years ago • 11 comments

Hello,

I've implemented a simple player that plays one sound in a new flutter web project and it works well. I've added the same code to a project I'm working on that includes firebase libraries (like firebase core for instance). Whenever I run the code in debug mode, I get this error, and if I refresh (hot reload), the error goes away and the app runs normally. I've deployed the code and it worked fine. What is this error and how can i get rid of it?

Error: Mismatched anonymous define() module: function() { return { Howler: Howler, Howl: Howl }; } http://requirejs.org/docs/errors.html#mismatch at makeError (http://localhost:59376/require.js:168:17) at intakeDefines (http://localhost:59376/require.js:1254:36) at Object.localRequire [as require] (http://localhost:59376/require.js:1446:21) at requirejs (http://localhost:59376/require.js:1797:24) at Function.req.config (http://localhost:59376/require.js:1805:16) at js.JsFunction._fromJs.callMethod (http://localhost:59376/dart_sdk.js:66027:35) at firebase_core_web.FirebaseCoreWeb.new._initializeCoreRequireJs (http://localhost:59376/packages/firebase_core_web/firebase_core_web.dart.lib.js:201:17) at _initializeCoreRequireJs.next (<anonymous>) at runBody (http://localhost:59376/dart_sdk.js:42630:34) at Object._async [as async] (http://localhost:59376/dart_sdk.js:42661:7) at firebase_core_web.FirebaseCoreWeb.new.[_initializeCoreRequireJs] (http://localhost:59376/packages/firebase_core_web/firebase_core_web.dart.lib.js:194:20) at firebase_core_web.FirebaseCoreWeb.new.initializeApp (http://localhost:59376/packages/firebase_core_web/firebase_core_web.dart.lib.js:227:47) at initializeApp.next (<anonymous>) at runBody (http://localhost:59376/dart_sdk.js:42630:34) at Object._async [as async] (http://localhost:59376/dart_sdk.js:42661:7) at firebase_core_web.FirebaseCoreWeb.new.initializeApp (http://localhost:59376/packages/firebase_core_web/firebase_core_web.dart.lib.js:223:20) at initializeApp (http://localhost:59376/packages/firebase_core/firebase_core.dart.lib.js:111:59) at initializeApp.next (<anonymous>) at runBody (http://localhost:59376/dart_sdk.js:42630:34) at Object._async [as async] (http://localhost:59376/dart_sdk.js:42661:7) at Function.initializeApp (http://localhost:59376/packages/firebase_core/firebase_core.dart.lib.js:110:20) at main$ (http://localhost:59376/packages/rest_interface/app/modules/unavail/views/unavail_view.dart.lib.js:7975:36) at main$.next (<anonymous>) at runBody (http://localhost:59376/dart_sdk.js:42630:34) at Object._async [as async] (http://localhost:59376/dart_sdk.js:42661:7) at main$ (http://localhost:59376/packages/rest_interface/app/modules/unavail/views/unavail_view.dart.lib.js:7973:18) at main (http://localhost:59376/web_entrypoint.dart.lib.js:39:29) at main.next (<anonymous>) at http://localhost:59376/dart_sdk.js:42610:33 at _RootZone.runUnary (http://localhost:59376/dart_sdk.js:42466:58) at _FutureListener.thenAwait.handleValue (http://localhost:59376/dart_sdk.js:37033:29) at handleValueCallback (http://localhost:59376/dart_sdk.js:37636:49) at Function._propagateToListeners (http://localhost:59376/dart_sdk.js:37674:17) at _Future.new.[_completeWithValue] (http://localhost:59376/dart_sdk.js:37516:23) at http://localhost:59376/dart_sdk.js:36647:46 at _RootZone.runUnary (http://localhost:59376/dart_sdk.js:42466:58) at _FutureListener.then.handleValue (http://localhost:59376/dart_sdk.js:37033:29) at handleValueCallback (http://localhost:59376/dart_sdk.js:37636:49) at Function._propagateToListeners (http://localhost:59376/dart_sdk.js:37674:17) at _Future.new.[_completeWithValue] (http://localhost:59376/dart_sdk.js:37516:23) at async._AsyncCallbackEntry.new.callback (http://localhost:59376/dart_sdk.js:37539:35) at Object._microtaskLoop (http://localhost:59376/dart_sdk.js:42771:13) at _startMicrotaskLoop (http://localhost:59376/dart_sdk.js:42777:13) at http://localhost:59376/dart_sdk.js:37905:9

kareem-darwinz avatar Feb 17 '22 00:02 kareem-darwinz

Same problem here. I assume this started from 9.1.1

GeorgeAmgad avatar Feb 21 '22 09:02 GeorgeAmgad

I don't really understand what the reason of this issue is. The major (only) change done on 9.1 for Flutter web is that the libraries are dynamically, loaded from the asset directory. You must not put anymore includes in your index.html

Larpoux avatar Feb 21 '22 09:02 Larpoux

I think the problem is because two different libraries are loaded. Please check that you don't include/import/require anymore any Flutter Sound and Howler libraries in your index.html. And tell us if this is better.

Larpoux avatar Feb 21 '22 10:02 Larpoux

I removed the added .js files from index.html but the problem still persists. however it runs normally after initiating hot restart.

GeorgeAmgad avatar Feb 21 '22 11:02 GeorgeAmgad

@GeorgeAmgad @kareem-darwinz Did you have any luck solving the issue? I'm having the same issues, there are no imports in the index.html and I also ran a flutter clean, the issue persists after a hot restart as well.

Edit: Are you both using Firebase? Debugging this seems that the error is thrown by the _initializeCoreRequireJs() when initializing a firebase App.

dius00 avatar Mar 15 '22 14:03 dius00

Yes, it was conflicting with firebase .. I had to fall back to ^8.5.0 and include the js files in index.html when things got more messy.

GeorgeAmgad avatar Mar 16 '22 10:03 GeorgeAmgad

Do you know if firebase depends on the Howler library?

Larpoux avatar Mar 16 '22 10:03 Larpoux

I am going to work on this issue during the next few days. (today and probably tomorrow i don't have access to my computer)

Larpoux avatar Mar 16 '22 10:03 Larpoux

Do you know if firebase depends on the Howler library?

Not 100% sure but it seems like it does, as the conflict is between firebase_core and flutter_sound.

GeorgeAmgad avatar Mar 16 '22 10:03 GeorgeAmgad

Do you know if firebase depends on the Howler library?

While at a first glance it would look like it does as the conflict is between firebase_core and flutter_sound. However, at first glance https://github.com/FirebaseExtended/flutterfire/tree/master/packages/firebase_core it doesn't seem like firebase_core_web has howler listed as a dependency.

dius00 avatar Mar 16 '22 13:03 dius00

@Larpoux Have you had the chance to look into the issue? We are currently still stuck on pre-9 due to this issue, any input would be appreciated.

dius00 avatar Apr 28 '22 20:04 dius00

This issue is stale because it has been open 90 days with no activity. Leave a comment or this will be closed in 7 days.

github-actions[bot] avatar Dec 05 '23 01:12 github-actions[bot]