When I run $ php bin/magento setup:di:compile command on local machine, it recompiles dependencies right away. When I do the same on staging server, it displays a message:

DI configuration must be cleared before running compiler. Please delete '/var/www/html/staging/var/di'.

Of course, when I delete var/di, it works. But my question is, why it does not require that directory to be deleted when running on local?

Local runs MAMP with php7.0.0.
Staging runs centos7 with php7.0.7, php-fpm and SElinux.

What difference between these two environments could lead to different command behavior?

  • Please delete '/var/www/html/staging/var/di'. have you deleted it ? – Minesh Patel Jun 23 '16 at 4:59
  • Yes I have and it worked. But I'm not asking how to make it work. I edited my question to be more clear. – Vasily802 Jun 23 '16 at 17:25

/var/di is only used in production mode. If it exists it needs to be deleted before you can run bin/magento setup:di:compile. I am assuming your local site is in developer mode and hence does not have this folder.

  • They both run in developer mode. At least console says so. But you are right - local does not have di folder and staging does. – Vasily802 Jun 23 '16 at 18:17
  • Ha! I just re-set the mode on staging to developer and ran compile command. It worked now. I guess the deploy:mode:show command was outputting wrong mode, not the one that application was actually in. – Vasily802 Jun 23 '16 at 18:24

You have to delete the directory, not only the files inside var/di. Took me a while to figure that out :-)

  • Thanks, but that's not what I'm asking about. I edited my question for more clarity. – Vasily802 Jun 23 '16 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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