[InvalidArgumentException] There are no commands defined in the "cache" namespace. enter image description here

I am using putty to run some commands. if I run php bin/magento setup:cache Is there any thing I missed during installation

  • which command you are trying ? – Pawan Oct 5 '18 at 1:46
  • Php bin/magento cache:flush – kiran Oct 5 '18 at 2:05
  • I uploaded all files on server then I run upgrade and cache flush commands using putty. it showing me above error. – kiran Oct 5 '18 at 2:07
  • once check with php bin/magento list, Is it showing all commands ? – Pawan Oct 5 '18 at 2:14
  • go through this link – Hitesh Oct 5 '18 at 4:29

Please run below commands

rm -Rf var/cache/* generated/*


php -f bin/magento cache:flush

php bin/magento indexer:reindex
| improve this answer | |

First, make sure that the module.xml file is defined properly in the etc directory of your module.

Then, run these commands in the root directory

rm -rf var/di/* var/generation/* var/cache/* var/page_cache/* pub/static/*
php bim/magento cache:clean
php bim/magento cache:flush
| improve this answer | |
  • Please update your answer, it is bin not bim – VishalParkash Oct 1 at 11:15

Solution 1:

The general main cause of this kind of error is missing etc/module.xml file in your module. Or, missing setup_version code inmodule.xml file.

Here is a sample module.xml file of a module named YourNamespace_YourModule.


<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Moddule/etc/module.xsd">
<module name="Namespace_Yourmodule" setup_version="1.5.0">


If you are not sure which module is creating this problem, you can try removing each module and check to find the problematic module.

Solution 2:

If solution 1 doesn’t help then you can try this second solution.

Give full control (read/write/execute) to var and pub directory solved this issue for me.

sudo chmod -R 777 var pub

You may also try running the following command:

sudo php -f bin/magento module:enable --clear-static-content YourNamespace_YourModule

| improve this answer | |

Seems some modules without file etc/module.xml

and this create error in command line

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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