The website is throwing a bunch of javascript errors. They are the kind that look like jquery was not loaded properly. These errors don't happen 100% of the time though. I don't understand requirejs enough to understand what is going on.
This is running Magento 2 and the Pearl theme by WeltPixel.
Not sure what else would be useful, should I post the source code of the page?
-
More details: It seems like some type of race condition as the actual errors will change as I shift-refresh the page.user59036– user590362017年09月22日 13:01:45 +00:00Commented Sep 22, 2017 at 13:01
4 Answers 4
This error is returned if you do not have permissions and/or static content is not generated.
You have to run the commands
php bin/magento cache:clean && php bin/magento cache:flush
and
php bin/magento setup:static-content:deploy
and make sure the permissions (777) are ok on /pub/static/frontend, the command of permission is:
chmod -Rf 777 pub/static/frontend
Yesterday was released a new release of Pearl theme, you can update the theme.
-
I'm confused. If it's a server issue, why aren't the errors consistent. If I hit refresh a few times it eventually loads fine.user59036– user590362017年09月22日 12:50:44 +00:00Commented Sep 22, 2017 at 12:50
-
There are no server problems, but if you did not run the deploy static content command when you refresh the page it compiles automatically, but it can block automatic compilation due to too much loadSt3phan– St3phan2017年09月22日 12:53:47 +00:00Commented Sep 22, 2017 at 12:53
-
The recommendation is to deploy to static content to better loadSt3phan– St3phan2017年09月22日 12:54:30 +00:00Commented Sep 22, 2017 at 12:54
-
Ran all commands. Errors went away on first SHIFT-REFRESH, but immediately came back on subsequent page loads.user59036– user590362017年09月22日 12:58:29 +00:00Commented Sep 22, 2017 at 12:58
-
You must clear cache browserSt3phan– St3phan2017年09月22日 13:00:09 +00:00Commented Sep 22, 2017 at 13:00
To anyone finding this in the future. My issue was around having a ShopperApproved integration.
I was able to narrow this down by disabling all extensions and then enabling them one at a time until the issue returned. After this I was able to say for certain that it was the ShopperApproved integration.
I then went into that extension and commented out all JS code that was added to the page. I then uncommented it file by file to see which was causing the issue.
In my case there were three different places that were an issue, but they all involved using script to add an external JS file to the HTML head. That JS file loaded jQuery if it wasn't found.
My solution was to wrap that code into the windows onload event so it would fire after all other JS. There is probably a better solution, but this worked. Since the issue was specific to my code base I will refrain from adding specific code here.
Please run the following commands,
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
This can happen when the $ variable is not set to be jQuery but some other framework. You could try why you enter $ in your console.
Apparently, when you refresh the page, one of the two wins and gets assigned to the $ variable randomly.
You could fix this in the code by putting:
(function ($) {
// Your code
}(jQuery));
around the code that needs to be executed. This makes sure $ refers to jQuery.
-
If I put $ in the console it returns fine. In face one of the lines that throws an error returns properly from the console ($.datepicker.RFC_2822) and it's wrapped in a require function: require([ "jquery", "jquery/ui" ], function($){ }); Would it help if you saw the site? review-stars-j2fvoyq-mqbydmn4mmpdk.us.magentosite.cloud/…user59036– user590362017年09月22日 16:17:02 +00:00Commented Sep 22, 2017 at 16:17