4

And because of this error, sometimes the cart and checkout pages don't load properly. Any clue how to fix this? I've already tried to regenerate the pub/static folder, but it's still the same.

Thanks in advance!

Error message

This is the custom script I added. Not sure if this is what's causing the conflict?

jQuery( document ).ready( function( $ ) {var quotes = $('.rollover');
var quoteIndex = -1;
function showNextQuote() {
    ++quoteIndex;
    quotes.eq(quoteIndex % quotes.length)
        .fadeIn(500)
        .delay(4000)
        .fadeOut(500, showNextQuote);
}

showNextQuote();switch (window.location.pathname) {
case '/faq-delivery/':
    $( '#accordion' ).accordion();}  } );

And my require.js link: https://www.floweraddict.com/pub/static/version1499097796/frontend/Mgs/organie/en_US/requirejs/require.js

1

This has been asked many times:

It can be caused by quite a few things, it's much easier to help if you include your Javascript. I'll paste my answer from another question.


According to the Require JS docs it's on of the following cases:

  • 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.

If you manually code a script tag in HTML to load a script with an anonymous define() call, this error can occur.

If you manually code a script tag in HTML to load a script that has a few named modules, but then try to load an anonymous module that ends up having the same name as one of the named modules in the script loaded by the manually coded script tag.

If you use the loader plugins or anonymous modules (modules that call define() with no string ID) but do not use the RequireJS optimizer to combine files together, this error can occur. The optimizer knows how to name anonymous modules correctly so that they can be combined with other modules in an optimized file.

If you use var define; at the top of your file for jshint/jslint purposes, this will cause a problem for the optimizer because it avoids parsing files that declare a define variable, since that may indicate a script that was created by a concatenation of some scripts that use a local define.

  • Thanks Ben. I did not really touch or created this, as we just bought the theme we're currently using. You can have a look at the file here: floweraddict.com/pub/static/version1499097796/frontend/Mgs/… – Lord A. Jul 3 '17 at 16:08
  • This is the custom Javascript I added, not sure if this is what's causing the conflict: jQuery( document ).ready( function( $ ) { var quotes = $(".rollover"); var quoteIndex = -1; function showNextQuote() { ++quoteIndex; quotes.eq(quoteIndex % quotes.length) .fadeIn(500) .delay(4000) .fadeOut(500, showNextQuote); } showNextQuote(); switch (window.location.pathname) { case '/faq-delivery/': $( "#accordion" ).accordion(); } } ); – Lord A. Jul 3 '17 at 16:09
  • If you remove the JS you've added does the error still occur? Also, make you you have flushed all caches and deleted var/view_preprocessed, pub/static/frontend and pub/static/_requirejs. Then compile your static files again (run php bin/magento setup:static-content:deploy if you don't know what I mean). – Ben Crook Jul 3 '17 at 16:27
0
  1. Open up app/etc/di.xml and find the virtualType name="developerMaterialization" section. In that section you'll find an item name="view_preprocessed" that needs to be modified or deleted. You can modify it by changing the contents from Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink to Magento\Framework\App\View\Asset\MaterializationStrategy\Copy
  2. Delete the files under pub/static to get rid of any existing symlinks. You may want to be careful not to delete the .htaccess file.

or uou can run below commands : a. php bin/magento setup:static-content:deploy & b. php bin/magento setup:upgrade

  • Thank you, but what is this supposed to do exactly? Just make the error go away? – Lord A. Jul 5 '17 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.