2

I need to install an extension (Mailchimp for Magento 2) on a website, but need to do it in a way that I won't need to run

bin/magento setup:upgrade.

Basically, the site was built by a developer long gone and has tons of problems, now running that upgrade command will require me to recompile with the command

bin/magento setup:di:compile 

which sometimes runs successfully and sometimes not, but always leaves the site in a broken state.

I have tried doing it via composer and the extension was added successfully, then the site broke after upgrading/compiling. I have not tried installing via the component manager because it requires the same upgrade command. Thanks!

2 Answers 2

2

setup:di:compile is not necessarily to run unless your compilation is ON. you can turn it off by just removing di.xml file in the var folder. Now just try to run on setup:upgrade command and clear cache. See whether this works.

You can give a try in this way too. Try to define the module manually by mentioning about the same in array of config.php path at <root>/app/etc/config.php. Here you can see an array with all the list of modules that are in your website. Add your module name in the list as 'Namespace_Module' => 1 for ex: 'Magento_Store' => 1. Now you need to enter your module details to database table setup_module. Check for the module version in the module.xml file of the module. Add the values accordingly to the table. Hopefully this should work.

2
  • I can't give it another shot until tomorrow. I'll give your suggestions a try and get back to you, thanks!
    – Aaron T
    Commented Sep 12, 2017 at 5:42
  • This one works great. Commented Oct 19, 2019 at 7:21
1
  1. It is always recommended to run setup:upgrade and you need to run di:compile after the new module to make the dependency Injection work without any issue.
  2. di:compile may fail because of multiple reason you can try switch off / stop other resources like nginx/apache , php-fpm before compiling will give you some ram space that di:compile can occupy or increase your ram size. It is recommended not to compile on production environment, you can compile somwhere else and deploy the compiled files in production.
  3. if you are working in a dev enviroment and don't want to break the website again and again and wait for the static:content:deploy to complete then use setup:upgrade --keep-generated.
  4. Its also not recommended to delete di.xml from var folder.

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.