0

I have a website in Magento 2.3.2. This morning the website was in production mode.

I added a custom module (I don't think is related to this problem)

run bin/magento setup:upgrade, bin/magento c:f, bin/magento c:c

Then I deleted generated/code/* and generated/metadata/*

and run bin/magento deploy:mode:set production

When the compilation is in progress I receive an error in step 5/7

In ClassReader.php line 35:

Class Magento\Sales\Model\Order\Email\Sender\OrderSender does not exist

First, I thought the problem could be the new module, so I deleted...

But the problem still remain. I cannot set the production mode.

3 Answers 3

0

First of all, check if the class exists or not. If it does not exist then run composer update command

Hope this will help.

2
  • The class exists on vendor/magento/module-sales/Model/Order/Email/Sender/OrderSender.php Namespace is Magento\Sales\Model\Order\Email\Sender; Class name is OrderSender
    – fmineo
    Jul 30, 2020 at 13:35
  • try to run composer update command
    – Nits
    Jul 30, 2020 at 16:56
0

try to run run bin/magento setup:di:compile

When I add a module in production mode I always run this

bin/magento set:up && bin/magento setup:di:compile

bin/magento setup:static-content:deploy

php bin/magento indexer:reindex && bin/magento c:f

You can put it in maintenance mode to do this too. Unless there is an error with your code it should work fine.

Hope it helps :D

5
  • I receive the error Class Magento\Sales\Model\Order\Email\Sender\OrderSender does not exist when run setup:di:compile on step 5/7 But the class exists
    – fmineo
    Aug 3, 2020 at 7:43
  • It might be calling in a place that it doesn't, but try to clear things up, rm -rf pub/static/*; rm -rf var/view_preprocessed/*; rm -rf generated/*; and compile everything again, might as well delete vendor and run composer upgrade so it starts fresh
    – Rui Silva
    Aug 3, 2020 at 8:55
  • In past, I had to edit some file of a vendor (I know is not a good practice), what happen if I run composer upgrade?
    – fmineo
    Aug 3, 2020 at 9:22
  • The files might revert back to the original that's why you should not edit them, but try first to remove static, generated and view and compile everything. If you removed the new module and it was the one giving the error it might got stuck in one of that folders
    – Rui Silva
    Aug 3, 2020 at 9:38
  • Btw to the person who downvoted, this is what I usually do, for you to downvote you might have a reason to do that so it'll be more helpful if you downvoted and after comment why you did it and, if you know, tell a better way to do it
    – Rui Silva
    Aug 4, 2020 at 9:48
0

In the Compilation feature of Magento will allow you to compile all files of a Magento installation, in order to create a single include path to increase performance. The performance increase is between 25% - 50% on page loads. In order to use this tool, the directory ‘includes’ and the file includes/config.php must both be writable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.