1

Magento 2.3.3 script errors in console. I have correct folder permissions set. Tried both Luma and Ultimo theme. Cleared static directory and regenerated content. Nothing has solved this issue? Any help?

enter image description here

enter image description here

9
  • Please update and specify in your question what's the meaning of 'correct folder permissions'. For instance, what about user / group ownership of both folders & files? – Raul Sanchez Dec 20 '19 at 17:03
  • I have set permissions according to the magento 2.3 guidelines. I also tried with 777 across entire magento root folder temporarily on a development box. Console errors doesn't seem to disappear. Also please note that the page is loading and I am able to see contents including categories and products and I have no issues in with their functionality. – Zoya Dec 20 '19 at 17:42
  • You have to click on the script at the right e.g. on console-output-handler.min.js:2:148 and inspect the error to find the cause. – Black Dec 20 '19 at 20:02
  • Have you checked, .htaccess is exists in pub/static folder or not ? If there no htaccess upload a .htaccess from default magento. – Suman Pradhan Dec 22 '19 at 5:40
  • 1
    Ok so you mean your website is working fine but getting lots of errors in consol correct? – Aasim Goriya Dec 23 '19 at 9:30
0

Please check and make sure .htaccess file is present with in var, pub/static, pub and generated folder, if not present then first you need to add .htaccess file as per Magento's standards.

Then run the below command to Magento root directory and set Magento ownership and user permissions for files and folders

Syntax: sudo chown -R [USER NAME]:[USER NAME] /var/www

Command: sudo chown -R www-data:www-data magento2

Note: Where www-data you need to set your user and group, set your directory name at magento 2

Then run all the below commands:

chmod -R 777 var/ pub/static/ generated/
rm -rf pub/static/* var/view_preprocessed/ generated/code/ var/cache/ generated/metadata/ var/page_cache/
php -dmemory_limit=8G bin/magento cache:clean
php -dmemory_limit=8G bin/magento cache:flush
chmod -R 777 var/ pub/static/ generated/
php -dmemory_limit=8G bin/magento setup:upgrade
chmod -R 777 var/ pub/static/ generated/
php -dmemory_limit=8G bin/magento setup:di:compile
php -dmemory_limit=8G bin/magento indexer:reset
php -dmemory_limit=8G bin/magento indexer:reindex
chmod -R 777 var/ pub/static/ generated/
php -dmemory_limit=8G bin/magento setup:static-content:deploy -f
chmod -R 777 var/ pub/static/ generated/

I hope above steps would solve your problem.

1
  • i have already done this. This hasn't helped – Zoya Dec 24 '19 at 5:58
0

@zoya Please can you goto your server files directory and see if error_log is generated there or in public_html folder. If this is after some customization then the module you added might be buggy and removing it will let you work normally.

After an upgrade magento sometimes gives jason js error

Specifically, this line inside page's html is causing the error:

<script type="text/x-magento-init">{"*": {"Magento_Ui/js/core/app": }}</script>

Solution is to create plugin for appendLayoutConfiguration() function:

public function aroundAppendLayoutConfiguration(
    \Magento\Ui\TemplateEngine\Xhtml\Result $result,
    \Closure $closure
) {
    $layoutConfiguration = $this->wrapContent(json_encode($this->utf8ize($this->structure->generate($this->component))));
    $this->template->append($layoutConfiguration);
}

Or for clear data

public function utf8ize($data) {
    if (is_array($data))
        foreach ($data as $key => $value)
            $data[$key] = $this->utf8ize($value);

    else if(is_object($data))
        foreach ($data as $key => $value)
            $data->$key = $this->utf8ize($value);

    else
        return utf8_encode($data);

    return $data;
}

Still you need to see error log or run magento in developers mode

-3

Remove pub/static folder and run static-content:deploy, after deploy give 777 permission to pub/static and generated folder.

Hope this helps you.

1
  • I have already tried that. Issue still exists. – Zoya Dec 19 '19 at 7:05

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.