Magento 2空白页但不为空

Ped*_*TFC 5 magento magento2

我正在开发一个正在运行但已停止的 Magento 2.3 站点。当我尝试向上翻一页时,我看到一个空白屏幕。看似空洞的,其实包含了一点内容:

  <!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>
Run Code Online (Sandbox Code Playgroud)

如果我查看系统日志,我会看到以下错误:

[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 [] []
Run Code Online (Sandbox Code Playgroud)

我启用了错误日志,但我什么也没得到。任何人都可以帮忙吗?

或者,有人可以向我指出 magento 2 如何构建页面的良好地图(或类似地图),以便我可以尝试追踪错误。

Ped*_*TFC 6

我已将问题追溯到 pub/generated/metadata/global.php 的问题。即使再生它也会导致同样的问题。如果我删除文件,一切似乎都正常。我承认不明白为什么!

我现在通过不运行 bin/magento setup:di:compile 来避免这种情况。我只是运行 php bin/magento setup:static-content:deploy。

  • 我删除了“生成”文件夹下的所有内容,除了“.htaccess”文件,这对我来说很有效。它位于根目录而不是“pub”目录下。 (2认同)

小智 1

我认为此错误是由于某些 XML 文件中的引用损坏造成的。您没有提到您在哪个页面上收到此错误。但你可以如下追踪:

首先,从以下路径重命名default.xml :

应用程序/设计/前端/供应商/Theme_name/Magento_Theme/layout/default.xml

刷新所有缓存并检查(php bin/magento 缓存:flush)

如果您没有找到任何内容,请重命名您的页面(主页、列表、详细信息页面等)相关文件。

例如,如果您在主页上收到此错误,则重命名 cms_index_index.xml。它可以驻留在您的主题或任何自定义扩展中。

希望这些信息可以帮助您解决问题。