During installation, Reflection Exception error


During the installation, a message similar to the following displays:

[ERROR] exception 'ReflectionException' with message 'Class Magento\Framework\StoreManagerInterface does not exist' 
in /<path>/lib/internal/Magento/Framework/Code/Reader/ClassReader.php


Clear all directories and files under Magento’s var subdirectory and install the Magento software again.

As the Magento file system owner or as a user with root privileges, enter the following commands:

cd <your Magento install directory>/var
rm -rf cache/* di/* generation/* page_cache/*