PHP Fatal error: Class 'Cli' not found in /home/xxx-xxx/public_html/bin/magento on line 31

xxx-xxx@rck:~/public_html$ php bin/magento

No lock file found. Unable to read locked packages#0

/home/xxx/public_html/vendor/composer/composer/src/Composer/Package/Locker.php(146): Composer\Package\Locker->getLockData()

Magento\Framework\Console\Cli->__construct('Magento CLI')

I am trying following commands:

php bin/magento

php bin/magento setup:upgrade
  • specify complete command which you try to run from Command line. Oct 6, 2017 at 6:38
  • I have updated the question, Kindly read again. Thanks! Oct 6, 2017 at 6:41
  • just try only this command "php bin/magento setup:upgrade" Oct 6, 2017 at 6:46
  • Already tried, No Luck Oct 6, 2017 at 6:47

1 Answer 1


You are missing the composer.lock file and you must run the commands:

composer update

After you ran the above command, you can run the command:

php bin/magento setup:upgrade
  • 1
    There was missing composer.lock and composer.phar file! I have uploaded both and DONE!! Oct 6, 2017 at 9:13
  • Your welcome. :)
    – St3phan
    Oct 6, 2017 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.