0

What should the content be in the Magento 2 root folder composer.json file AFTER Magento is installed? When I add a new module, should I add this to the existing list (require, etc)?

Should all the installed modules be listed here always?

0

You don't exactly need to edit that file, but it will be modified and will reflect the installed modules yes, with the exception of local modules living in the app/code/ folder.

When you install new modules, you will use composer require vendor/module, this will change the content of your composer.json file accordingly and regenerate the composer.lock with the last changes.

When installing the project (let's say, for deployment), you can use composer install to read the composer.lock and fetch all your modules with the correct version.

  • OK! What if I manually install a module that has no composer.json file = developer instuction is to just upload app & pub files and run php bin/magento setup:upgrade, then will that module get listed also in the Magento root composer.json file? If a module it's not listed in root composer.json, will it be removed the next time I run composer install ? – M2user Sep 9 at 13:53
  • No it won't be listed because it's completely outside the Composer system in that scenario. It won't be deleted either, don't worry. The developer should use Composer though, it's much easier for everyone involved and can work with a simple Git repository. – loic_adexos Sep 9 at 14: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.