I am developing a Magento 2.3 site which was working but has stopped. When I try to get a page up, I get a blank screen. Although it looks empty, it actually contains a little content:
<!doctype html>
<html lang="en">
<head >
<meta charset="utf-8"/>
<meta name="description" content="Blah Blah"/>
<meta name="keywords" content="More blah blah"/>
<meta name="robots" content="INDEX,FOLLOW"/>
<title></title>
<link rel="icon" type="image/x-icon" href="http://www.magento2.domain/pub/media/favicon/stores/1/3-ladies-bg.jpg" />
<link rel="shortcut icon" type="image/x-icon" href="http://www.magento2.domain/pub/media/favicon/stores/1/3-ladies-bg.jpg" />
<link href='https://fonts.googleapis.com/css?family=Prosto+One' rel='stylesheet' type='text/css' />
<!--xxxabb2c66c7681e8f658-->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxx-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-131267613-1');
</script> </head>
<body data-container="body" data-mage-init='{"loaderAjax": {}, "loader": { "icon": "http://www.magento2.domain/pub/static/version1551796553/frontend/_view/en_GB/images/loader-2.gif"}}' class="cms-index-index page-layout-1column">
</body>
</html>
If I look in the system log, I see the following errors:
[2019-04-30 21:24:48] main.INFO: Broken reference: the 'theme.active.editor' element cannot be added as child to 'after.body.start', because the latter doesn't exist [] []
[2019-04-30 21:24:48] main.INFO: Broken reference: the 'logger' element cannot be added as child to 'after.body.start', because the latter doesn't exist [] []
I’ve enabled error logging but I get nothing. Can anyone help?
Alternatively, can somebody point me to a good map (or similar) of how magento 2 builds a page so I can try and track down the error.
5
Answers
I have tracked down the issue to a problem with pub/generated/metadata/global.php. Even regenerating it causes the same problem. If I delete the file everything seems to work ok. I confess to not understanding why!
I now avoid this by not running bin/magento setup:di:compile. I simply run php bin/magento setup:static-content:deploy.
I think this error is due to a broken reference in some XML file. You have not mentioned in which page you are getting this error. But you can trace it as below:
First of all, rename your default.xml from below path:
app/design/frontend/Vendor/Theme_name/Magento_Theme/layout/default.xml
Flush all the cache and check(php bin/magento cache:flush)
If you don’t find anything then rename your page(homepage, listing, detail page, etc) related file.
For example, if you are getting this error on the homepage then rename cms_index_index.xml.It can reside in your theme or any custom extension.
Hopefully, this information can help you with the issue.
I am using Magento 2.3.2 version. In production mode generating generated directory using setup:di:compile is working fine. However, in developer mode doing same is making all pages on frontend blank but not empty (content inside body tag is empty) so I deleted the generated folder and let it be created automatically as I access the site pages. Doing this resolved the issue for me.
remove everything under generated folder except .htaccess file
Just go to Magento directory and then delete file generated by di:compile is path :-
magentogeneratedmetadataglobal.php
delete this file then after refersh your page.This is temporary solution for this error in local server.