Magento – Magento 2 Error: Class does not exist

magento2PHP

I see this error

3 exception(s): Exception #0
(Magento\Framework\Exception\LocalizedException): Invalid block type:
Crediya\Minicalculadora\Block\Data Exception #1 (ReflectionException):
Class CrediYa\CrediYa\Model\CrediYa does not exist Exception #2
(ReflectionException): Class CrediYa\CrediYa\Model\CrediYa does not
exist

But the class does exist, if I use the command

php bin/magento setup:di:compile

I get the following error

Fatal error: Class 'CrediYa\CrediYa\Model\CrediYa' not found in /var/www/html/magento2/generated/code/CrediYa/CrediYa/Model/CrediYa/Interceptor.php on line 7

How can I solve these errors?

Best Answer

This is showing that Class 'CrediYa\CrediYa\Model\CrediYa' is not exist in your module. Also you can check the class namespace whichever it used by CrediYa. so you can find & correct it.