Solved: Blank Pages Issue After Compilation Command in Magento 2
Ever faced blank pages issue after compilation command in Magento 2? or ever got the fatal error that states:
Uncaught Error: Call to a member function setActive() on boolean
The variety of tasks depends on the ‘php bin/magento setup:di:compile ‘command in Magento 2 store.
Especially while working with dependency injection configuration, repositories code generation, and application code generation, need often arrives to use the compilation command.
I’ve observed many of us tend to delete the ‘generated’ folder to solve this issue.
By default, Magento generates code to create non-existent factory classes if the class is injected in a constructor and stores all of Magento’s code in the ‘generated’ folder.
Hence, for this particular issue, it’s not always advisable to delete the whole generated folder. Instead of this, it is recommended to use the below solution:
Solution to Blank Pages Issue After Compilation Command in Magento 2:
This issue arrives because the globle.php file gets generated after the compilation command.
Therefore, instead of removing the complete generated folder; remove the globle.php file located at generated\metadata\
Refresh your page.
And you are done! The page will work the same as before.
If you have any doubts regarding this solution, just mention them in the Comments section below.
I would be happy to help.
Feel free to share the solution with Magento Community via social media.
Thank You.
Sanjay Jethva
Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe.
His passion for Magento 2 and Shopify solutions has made him a trusted source for businesses seeking to optimize their online stores. He loves sharing technical solutions related to Magento 2 & Shopify.
Prev
Solved: Type Error Occurred When Creating Object in Magento 2
How to Add Timezone & Locale Dropdown in Custom Form in Frontend in Magento 2
Next