26

This question already has an answer here:

I have problem when I run this command:

php bin/magento setup:upgrade

Display error:

[InvalidArgumentException]
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

marked as duplicate by Community Feb 17 '17 at 7:08

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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

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

  • 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
25

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

4

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)
0

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.

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