5

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

4 Answers 4

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
2
  • what is the purpose & use of this di directory in magento? Jun 30, 2016 at 8:36
  • when in developer mode, is it normal I got a 'generated' folder in the root after running that command?
    – apedic
    Sep 10, 2017 at 9:04
0

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

bin/magento setup:di:compile

Magento will generate the files

9
  • Yes but when I try to execute this command, I am getting error Jun 30, 2016 at 7:25
  • 1
    What is that error? Jun 30, 2016 at 7:26
  • 1. var/generation folder is not empty 2.class Cli not found. Jun 30, 2016 at 7:26
  • If i try to delete generation folder ,it automatically regenerates instantly. Jun 30, 2016 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. Jun 30, 2016 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 and acknowledge you have read our privacy policy.

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