I have problem when I run this command:

When running this commond after making custom modules.

php bin/magento setup:upgrade

I also try running the command.

sudo chmod -R 777 var pub

sudo php bin/magento setup:upgrade

But still gives same error.

enter image description here

  • share a screenshot of the command you are entering to get an idea of the location and exactly what you are trying.
    – Dharam
    Nov 14, 2017 at 9:11
  • Please update the error you're getting Nov 14, 2017 at 9:13
  • I shared screnshot of my terminal.Hope you will getting exact bug. Nov 14, 2017 at 9:23

6 Answers 6


Run php bin/magento list command. It will listed all the magento 2 commands interface if everything working correctly. If something is going wrong, this will also give you error message that why it is failing.

You can check with https://magento.stackexchange.com/a/91696/1905 also.

  • I already apply this step.which are mentioned from previous occurs query . Nov 14, 2017 at 7:28
  • It may be due to folder permission of var and pub. Also check chown permission. Nov 14, 2017 at 7:30

Try this one :

php -f bin/magento setup:upgrade

  • Same error occurs, not changes something . Nov 14, 2017 at 7:31
  • Check module.xml file of your last installed extension. This error generally because of this file only Apr 25, 2019 at 6:20

Please check the path of command you entered. Also please try this sudo php bin/magento setup:upgrade

  • path is correct,that is magento root directory. Nov 14, 2017 at 7:30

empty var/generation and var/di. clear the cache. check folder permissions and then run magento list. if that gives a list of commands you can run setup:upgrade. otherwise it should give an error you can post here.


I got this error for all commands in cli (not just setup) when I had a custom module that I was working on that didn't have a module.xml file. (More precisely, it did have one but I put it in the wrong place. :-/ )

If you're getting this while actively working on a module, check to see if your module's etc/module.xml is missing or unreadable or otherwise incorrect.


Check module.xml file of your last installed extension. This error generally occurs because of this file only.

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.