How to fix ReflectionException error during Magento 2 installation
Lots of obstacles prevent you from installing Magento 2 successfully. However, there are numerous solutions the ecosystem offers. This time, we describe how to fix the ReflectionException error, that doesn’t let you leverage our favorite e-commerce platform. More obstacles and different ways to bypass them are described here: Magento 2 Cookbook.
The Issue
You are trying to install Magento 2 but a message similar to the following displays:
1 |
[ERROR] exception 'ReflectionException' with message 'Class Magento\Framework\StoreManagerInterface does not exist' in /<path>/lib/internal/Magento/Framework/Code/Reader/ClassReader.php |
The missing class causes the issue. How to restore it, you will ask?
The Solution
Firstly, you have to go to Magento’s var subdirectory and clear all the directories and files there. Next, reinstall the Magento 2 software. You have to enter the following commands as a user with root privileges:
1 2 |
cd <your Magento install directory>/var rm -rf cache/* di/* generation/* page_cache/* |
Also, note that you can still get this error after reinstalling the software if you use Redis. To solve the problem, you have to clear the Redis cache. To do that, use the following command:
1 |
redis-cli FLUSHALL |
Follow