{"id":1560,"date":"2021-02-07T16:28:19","date_gmt":"2021-02-07T16:28:19","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/solution-blank-pages-issue-after-compilation-command-in-magento-2\/"},"modified":"2025-07-17T09:40:02","modified_gmt":"2025-07-17T04:10:02","slug":"solution-blank-pages-issue-after-compilation-command-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/solution-blank-pages-issue-after-compilation-command-in-magento-2\/","title":{"rendered":"Solved: Blank Pages Issue After Compilation Command in Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Ever faced&nbsp;<em><strong>blank pages issue after compilation command in Magento 2?<\/strong><\/em>&nbsp; or ever got the fatal error that states:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em><strong>Uncaught Error: Call to a member function setActive() on boolean<\/strong><\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The variety of tasks depends on the \u2018<strong>php bin\/magento setup:di:compile<\/strong>\u00a0\u2018command in\u00a0Magento 2\u00a0store.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Especially while working with dependency injection configuration, repositories code generation, and application code generation, need often arrives to use the compilation command.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I\u2019ve observed many of us tend to delete the \u2018generated\u2019 folder to solve this issue.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">By default, Magento generates code to create non-existent factory classes if the class is injected in a constructor and stores all of Magento\u2019s code in the \u2018generated\u2019 folder.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Hence, for this particular issue, it\u2019s not always advisable to delete the whole generated folder. Instead of this, it is recommended to use the below solution:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Solution to Blank Pages Issue After Compilation Command in Magento 2:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This issue arrives because the&nbsp;<strong>globle.php<\/strong>&nbsp;file gets generated after the compilation command.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Therefore, instead of removing the complete generated folder; remove the&nbsp;<strong>globle.php<\/strong>&nbsp;file located at&nbsp;<strong><strong>generated\\metadata\\<\/strong>&nbsp;<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Refresh your page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And you are done! The page will work the same as before.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Feel free to share the solution with Magento Community via social media.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank You.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ever faced&nbsp;blank pages issue after compilation command in Magento 2?&nbsp; or ever got the fatal error that states: Uncaught Error: Call to a member function&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-1560","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1560","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=1560"}],"version-history":[{"count":3,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1560\/revisions"}],"predecessor-version":[{"id":14512,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1560\/revisions\/14512"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=1560"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=1560"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=1560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}