Pregunta

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?

¿Fue útil?

Solución

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

Otros consejos

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a magento.stackexchange
scroll top