I have a problem with Magento, I use X-debug for trying to debug Magento and I have the following Exception:

Exception Has ocurred. InvalidArgumentException: Composer could not find the config file: /var/www/site/magento/var/composer_home/composer.json To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section

So yeah it's right in magento/var there is no composer.json, BUT this is a Magento core folder and included in .gitignore given by Magento to one of this famous "don't touch" folder from Magento.

This exception is thrown by the function createComposer in vendor/composer/composer/src/Composer/Factory.php

Someone had similar error ? If yes how did you deal with it ?

PS: in case of minus please let me know why so then I can upgrade this post

2 Answers 2


Ok since commenting is not enabled. I kept digging with no answers. Then I thought I would create the composer.json file in var/composer_home. The contents of said file was:


Now I am able to execute bin/magento commands without the exception. I'm certain there is another issue, but unless someone can find it this is the workaround I'm using.


I don't have a solution but today I just saw this same error messaging when performing any bin/magento command.

  • If you don't have solution or proper answer than just don't put as an answer. Sep 10, 2020 at 6:45

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.