1

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?

2
  • Please delete '/var/www/html/staging/var/di'. have you deleted it ? Jun 23, 2016 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, 2016 at 17:25

2 Answers 2

2

/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.

2
  • 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, 2016 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, 2016 at 18:24
1

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

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

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.