I have problem when I run this command:

php bin/magento setup:upgrade

Display error:

There are no commands defined in the "setup" namespace.

I found some answers but not in my case(I run in Windows 7 and Xampp).
There are no commands defined in the “setup” namespace : Magento 2

On frontend display:
enter image description here Last time, I fixed is system my pool code have error with my module. And now I remove all my modules but error until display. Anyone used to fixed this problem, Can you tell how to fix this problem?

When I run command to install again composer , it return error below:
enter image description here

  • 1
    check extensions, maybe missing module.xml file – Alex Feb 1 '19 at 13:20

Run this command:

php bin/magento list

When everything is working correctly, this should list out all of the possible commands in your Magento 2 command line interface. However, in the event that something is going wrong, this will also give you a much more descriptive error message about how and why it is failing.

This could be the result of an invalid composer.json module file, among other things.

See also: https://magento.stackexchange.com/a/91696/1905

| improve this answer | |
  • Thanks @Ryan. I tried many other answers, but yours helped me only. – Mohit Kumar Arora Sep 1 '16 at 5:05
  • Thanks, for me it thrown even error in list command but later i realized there is folder right problem – AbdulBasit Oct 11 '17 at 13:01
  • 1
    Great answer because it gives a more detailed error message. Was able to track down the issue after running this command. – Cypher909 Oct 10 '19 at 15:21
  • thanks it was helpful it showed some error instead of nothingness – Jacek Pietal Jan 21 at 15:12

Also happens when the module name in module.xml does not match with path based namespace. Please check your module name again: code/Vendor/myModuleName/etc/module.xml

We can read more here: https://gist.github.com/bka/d44fb33d1eaf780e1b76

| improve this answer | |

I had the same issue and I followed several suggested stupid suggestions to fix the problem like delete my composer.json something like that. But those didn't fix my problem. Today, I faced the problem again and I tried a new approach to trace the problem. All details and screenshot are in my personal blog post http://david.firstbiz.cc/blog_detail.php?id=115 I described my steps here:

1. for CLI, please append "-vvv" and it will display function trace paths
2. try to load any product page and check your web server error log and you will be able to see more details.
3. the class name and the filename should be same (*this is the case I faced)
| improve this answer | |
  • You blog is not reachable – Black Jan 31 at 10:35

If anyone have dependencies (especially coming from custom modules) in you CLI class, you have to check all of the class for possible problems. If somewhere you are playing around with RequestInterface it can cause problem - but don't know why.

| improve this answer | |

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