When I try to run a bin/magento command, I get this error:

Composer file not found#0 /var/www/html/vendor/magento/framework/Composer/ComposerFactory.php(47): Magento\Framework\Composer\ComposerJsonFinder->findComposerJson()
#1 /var/www/html/vendor/magento/framework/Composer/ComposerInformation.php(368): Magento\Framework\Composer\ComposerFactory->create()
#2 /var/www/html/vendor/magento/framework/Composer/ComposerInformation.php(381): Magento\Framework\Composer\ComposerInformation->getComposer()
#3 /var/www/html/vendor/magento/framework/Composer/ComposerInformation.php(244): Magento\Framework\Composer\ComposerInformation->getLocker()
#4 /var/www/html/vendor/magento/framework/App/ProductMetadata.php(122): Magento\Framework\Composer\ComposerInformation->getSystemPackages()
#5 /var/www/html/vendor/magento/framework/App/ProductMetadata.php(82): Magento\Framework\App\ProductMetadata->getSystemPackageVersion()
#6 /var/www/html/vendor/magento/framework/Console/Cli.php(98): Magento\Framework\App\ProductMetadata->getVersion()
#7 /var/www/html/bin/magento(22): Magento\Framework\Console\Cli->__construct('Magento CLI')
#8 {main}

Here is what I tried so far:

  • bin/magento clear:cache & bin/magento cache:flush - gives the same error above.
  • composer install - gives the same error above.
  • composer update - gives Composer could not find a composer.json file in /Users/Ismail/Development/magento2project

How can I fix this issue? Thanks in advance!

1 Answer 1


Did you check if composer is installed and configured correctly. What happens when you run composer --version? If its installed, check to see if its enabled globally. Go over the steps from https://getcomposer.org/doc/00-intro.md and try again. One more thing, did you install Magento via composer or dowloaded it as a zip ?

  • 1
    Hi thanks for your suggestion. The problem was that I had to restart my docker container.
    – Ismail
    Commented Nov 13, 2020 at 10:10

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.