0
sudo php bin/magento setup:upgrade -vvv
Cache cleared successfully
File system cleanup:
PHP Fatal error:  Uncaught Error: Cannot use object of type Closure as array in /var/www/croquenoix/dev/croquenoix/web/setup/src/Magento/Setup/Model/Installer.php:1288
Stack trace:
#0 /var/www/croquenoix/dev/croquenoix/web/setup/src/Magento/Setup/Model/Installer.php(1013): Magento\Setup\Model\Installer->cleanupGeneratedFiles()
#1 /var/www/croquenoix/dev/croquenoix/web/setup/src/Magento/Setup/Console/Command/UpgradeCommand.php(72): Magento\Setup\Model\Installer->updateModulesSequence(false)
#2 /var/www/croquenoix/dev/croquenoix/web/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(257): Magento\Setup\Console\Command\UpgradeCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /var/www/croquenoix/dev/croquenoix/web/vendor/symfony/console/Symfony/Component/Console/Application.php(874): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 in /var/www/croquenoix/dev/croquenoix/web/setup/src/Magento/Setup/Model/Installer.php on line 1288

The stack trace is not long enough for me to figure where the error really comes from. How can I see a longer stack trace? How can I debug this error?

  • I have the same issue. after upgrading to Magento 2.3.1 and the cause is that there is an extension that is not compatible with Magento 2.3.1 then I disabled it and there it is now fixed. – MazeStricks Apr 02 '19 at 16:05

5 Answers5

3

It must be issue in any custom extension, Please try to remove your custom extension and try to install them one by one. It works for me. May be helpful for other.

Jarnail
  • 56
  • 5
  • it turns out this was the case. an extension I had recently installed caused this. I removed it and the error went away. after I have upgraded the Magento 2 version to the latest and then was able to reinstall the extension and did not have the error this time. – Pierre-Verthume Larivière Aug 08 '18 at 01:14
  • You mean bin/magento module:disable or complete REMOVE using composer remove? – snh_nl Apr 23 '19 at 12:00
  • Just disable the modules – Jarnail May 06 '19 at 09:55
2

Try

bin/magento setup:upgrade --keep-generated
Teja Bhagavan Kollepara
  • 3,816
  • 5
  • 32
  • 69
1

Please run below commands :

 1. rm -rf generated/
 2. sudo chmod -R 777 generated/

then run di compile command :

 php bin/magento setup:di:compile
Charvi Parikh
  • 1,360
  • 16
  • 24
0

Try this: We recursively delete the folder var/cache and generation/ . In the generation folder, what is created when run the bin/magento setup:di:compile.

sudo rm -rf var/ generation/

Grant the rights to the current directory

sudo chmod -R 0777 .

sudo bin/magento setup:di:compile

sudo bin/magento setup:upgrade
Eugene Kapelko
  • 2,364
  • 1
  • 13
  • 29
0
  1. 1st delete var/cache and generation folders

  2. run command :

     sudo bin/magento setup:upgrade
    
  3. give full permission to :

    sudo chmod -R 0777 var/ pub/ generation/ 
    
  4. and run below command :

     sudo bin/magento setup:di:compile
    
suresh-vagvala
  • 194
  • 1
  • 16
  • What will happen if he deleted .htaccess in pub folder?? Do you know? – Eugene Kapelko Jun 05 '18 at 06:18
  • ir you deleted .htaccess file the page not loaded properly...please refer below link for your more clarification ......https://magento.stackexchange.com/questions/136879/accidentally-deleted-htaccess-file-inside-pub-static-folder – suresh-vagvala Jun 19 '18 at 09:44