Magento 2 - There are no commands defined in the "setup" namespace on windows
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
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
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)