5

There is no di folder generated in var directory. I am getting please re-run compile command. Why we need this di directory?

5

If you have upgraded to Magento version 2.2.* then

var/generation has been moved to generated/code

and

var/di has been moved to generated/metadata

There shouldn't be var/di and var/generation folders after the upgrade.

2

di folder are generate at compile time inside var folder.

remove content of generation folder. if di folder is not available first create di folder inside var folder.

Run command,

php bin/magento setup:di:compile
  • what is the purpose & use of this di directory in magento? – user2431224 Jun 30 '16 at 8:36
  • when in developer mode, is it normal I got a 'generated' folder in the root after running that command? – Antonio Pedicini Sep 10 '17 at 9:04
2

You are probably running Magento in developer mode. In developer mode, var/di is not generated and should be deleted.. Never run compile commands in developer mode (see also: Which compilation commands are needed in developer mode and when?)

Also, if you are in developer mode and previously used compile commands, or switched from production mode:

  • delete var/di and var/generation
  • delete pub/static/*, keep pub/static/.htaccess

The message you received is misleading, it only applies to production mode!

0

di folder is generated by magento itself. Each time you run:

bin/magento setup:di:compile

Magento will generate the files

  • Yes but when I try to execute this command, I am getting error – user2431224 Jun 30 '16 at 7:25
  • 1
    What is that error? – Amin Memariani Jun 30 '16 at 7:26
  • 1. var/generation folder is not empty 2.class Cli not found. – user2431224 Jun 30 '16 at 7:26
  • If i try to delete generation folder ,it automatically regenerates instantly. – user2431224 Jun 30 '16 at 7:27
  • you might need to clear the cache using: sudo rm -rf var/cache/* var/generation/* and give the ownership to Magento file system owner. – Amin Memariani Jun 30 '16 at 7:39
0

Magento itself creates the directory, var/di.

Missing of this directory (may be due to permission issue) causes

please re-run compile command

message during running of

setup:upgrade command.

I also faced same issue. Then I manually created 'di' directory inside 'var' directory and set proper permission. It solved this issue for me. Then after I didn't get any such message.

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.