cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2: setup:upgrade / di:compile error

SOLVED

Magento 2: setup:upgrade / di:compile error

I can not install or uninstall magento 2 plugins / modules. I have the default theme Luma, and magento 2.2.4.

I'm in developer mode. Whenever I try to install a plugin, or uninstall a plugin by SSH or by Magento backend, I get an error.

 

Warning: include(../public_html/generated/metadata/global.php): failed to open stream: No such file or directory in ../public_html/vendor/magento/framework/App/ObjectManager/ConfigLoader/Compiled.php on line 31

Warning: include(): Failed opening '../public_html/generated/metadata/global.php' for inclusion (include_path='../public_html/generated/code:../public_html/generated/code:../public_html/vendor/magento/zendframework1/library:.:/usr/local/php71/lib/php') in ../public_html/vendor/magento/framework/App/ObjectManager/ConfigLoader/Compiled.php on line 31

Fatal error: Uncaught TypeError Argument: 1 passed to Magento\Framework\ObjectManager\ObjectManager::configure() must be of the type array, boolean given, called in ../public_html/vendor/magento/framework/App/ObjectManager/Environment/Compiled.php on line 108 and defined in ../public_html/vendor/magento/framework/ObjectManager/ObjectManager.php:82 Stack trace: #0 ../public_html/vendor/magento/framework/App/ObjectManager/Environment/Compiled.php(108): Magento\Framework\ObjectManager\ObjectManager->configure(false) #1 ../public_html/vendor/magento/framework/App/ObjectManagerFactory.php(187): Magento\Framework\App\ObjectManager\Environment\Compiled->configureObjectManager(Object(Magento\Framework\Interception\ObjectManager\Config\Compiled), Array) #2 ../public_html/vendor/magento/framework/App/Bootstrap.php(208): Magento\Framework\App\ObjectManagerFactory->create(Array) #3 in ../public_html/vendor/magento/framework/ObjectManager/ObjectManager.php on line 82

These errors are only solved when I run bin/magento setup:di:compile. After I run that, no changes are made, my new plugin is not showing, or when uninstalling: is still showing.

I have tried cache flush/clean, setup:upgrade, permissions are 755 on generated dir. I don't know why I should run di:compile as i'm in developer mode, but more importantly: why I can not install new plugins/uninstall plugins.

 

What should I do?

ps. Plugin like language pack from Mageplaza, ho-nl dutch translation and other fully supported Magento 2 plugins.

5 REPLIES

Re: Magento 2: setup:upgrade / di:compile error

Remove generated folder from root of magento instance.

Set permission for var and generated folder and install again.

If Issue Solved, Click Kudos/Accept As solutions.

Re: Magento 2: setup:upgrade / di:compile error

Does not work, after deleting the generated folder, clearing and flushing the cache, and do or do not a bin/magento setup:upgrade the error stays the same.

So i have to di:compile to even see my website, plugin is not installed however.

 

 

 

Re: Magento 2: setup:upgrade / di:compile error

@karstenmissot

 

Try below commands to install module.

php bin/magento cache:flush
rm -rf var/generation/* var/cache/* var/report/* pub/static/frontend/* pub/static/adminhtml/* var/page_cache/* var/di/* generated/*
php bin/magento setup:upgrade

afterwards apply permission to var, pub/static folder  and try to install/uninstall again.

Re: Magento 2: setup:upgrade / di:compile error

Thanks for workflow, this is what i did / do:

 

rm -rf generated/* rm -rf pub/static/* and rm -rf var/*

 

install module with composer wget or manual ftp.

After this i do bin/magento c:c and bin/magento c:f.

Next step is bin/magento setup:upgrade, bin/magento setup:static-content:deploy nl_NL -f (for dutch language).
After this bin/magento setup:di:compile

And clearing all cache in backend of magento.

Re: Magento 2: setup:upgrade / di:compile error

@karstenmissot
Glad to know your issue get resolved Smiley Happy