mismatched anonymous define() module; function()return g) http://requorejs.org/docs/errors.html#mismatch

1

Hi,

I’m confused what this has to do with Matomo. Can you please explain?

Hi Lukas,

We are using Moodle based environment for Matomo Analytics. We get the following error as dialogue box when we log into LMS through chrome and Edge.

mismatched anonymous define() module; function()return g) http://requorejs.org/docs/errors.html#mismatch

We get the above screen shot while check with the chrome developer tool - console.

Can you suggest solution for this error?

Priya

Hi,

I’m still slightly confused. Matomo doesn’t use requirejs.

Can you check the network tab to see which request is failing and what this first.js is where the error is occuring?

Hi Lucas,

Nothing is fall in network tab. The network tab shows blank

Hi Lukas,

My matomo js folder shows the following images:
image

But my scripts shows the following image:
image

Whether I have to change matomo instead of piwik

No,

Matomo uses the matomo.js and matomo.php that are outside of the js directory in the root directory of Matomo

You have to have the network tab open when reloading the page to see all requests there.

The network tab

I’m getting the same error in Magento which also uses requirejs. I traced the problem to this line of code in matamo:

        // Expose Matomo as an AMD module
        if (typeof define === 'function' && define.amd) {
            define('piwik', [], function () { return Matomo; });
            define('matomo', [], function () { return Matomo; });
        }

in gihtub /matomo-org/matomo/blob/5.x-dev/js/piwik.js#L7879

I’m not sure what the fix would be. It seems matomo is using the require js api correctly.