E:\xampp\htdocs\magento-2>php -dmemory_limit=5G bin/magento setup:di:compile The directory "E:/xampp/htdocs/magento-2/var/generation/Magento/Framework" canno t be deleted Warning!rmdir(E:/xampp/htdocs/magento-2/var/generation/Magento/Fram ework): Directory not empty#0 E:\xampp\htdocs\magento-2\vendor\magento\framework \Filesystem\Driver\File.php(403): Magento\Framework\Filesystem\Driver\File->dele teDirectory('E:/xampp/htdocs...')

  1. E:\xampp\htdocs\magento-2\vendor\magento\framework\Filesystem\Driver\File.php (403): Magento\Framework\Filesystem\Driver\File->deleteDirectory('E:/xampp/htdoc s...')
  2. E:\xampp\htdocs\magento-2\setup\src\Magento\Setup\Console\CompilerPreparation .php(68): Magento\Framework\Filesystem\Driver\File->deleteDirectory('E:/xampp/ht docs...')
  3. E:\xampp\htdocs\magento-2\vendor\magento\framework\Console\Cli.php(74): Magen to\Setup\Console\CompilerPreparation->handleCompilerEnvironment()
  4. E:\xampp\htdocs\magento-2\bin\magento(22): Magento\Framework\Console\Cli->__c onstruct('Magento CLI')
  5. {main} PHP Fatal error: Class 'Cli' not found in E:\xampp\htdocs\magento-2\bin\magento on line 31

Fatal error: Class 'Cli' not found in E:\xampp\htdocs\magento-2\bin\magento on l ine 31


Removed your var/generation directory and var/cache directory.

You need to remove it manually, if it is ubuntu then locate in your magento 2 root directory and run rm -rf var/generation and rm -rf var/cache command.

Then try to run below commands in sequence.

  • php bin/magento setup:di:compile
  • php bin/magento setup:upgrade
  • php bin/magento cache:clean
  • php bin/magento cache:flush
  • mine is a windows system – learner Jun 23 '17 at 9:59
  • @Priya then remove it manually. – Manthan Dave Jun 23 '17 at 11:05

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.