Solved : Blank Pages Issue After Compilation Command in Magento 2

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.

Get Weekly Updates

Never miss Magento tips, tricks, tutorials, and news.

Thank you for subscribing.

Something went wrong.

5
(based on 12 Reviews)

Amit was a Magento developer at Meetanshi. He has good experience in Information Technology and education field over more than 8 years.

Leave a reply:

Your email address will not be published.