22

Update

Everything is working now but There are no commands defined in the "cache" namespace is still there. I tried chmod 777 -R var/generation, didn't fix a thing. AFAIK no module is enabled

   public_html]# bin/magento module:status
List of enabled modules:
Nosto_Tagging

List of disabled modules:
Magento_Store
Magento_AdvancedPricingImportExport
Magento_Directory
Magento_Theme
Magento_Backend
Magento_Backup
Magento_Eav
Magento_Customer
Magento_BundleImportExport
Magento_AdminNotification
Magento_CacheInvalidate
Magento_Indexer
Magento_Cms
Magento_CatalogImportExport
Magento_Catalog
Magento_Rule
Magento_Msrp
Magento_Search
Magento_Bundle
Magento_Quote
Magento_CatalogUrlRewrite
Magento_Widget
Magento_SalesSequence
Magento_CheckoutAgreements
Magento_Payment
Magento_Downloadable
Magento_CmsUrlRewrite
Magento_Config
Magento_ConfigurableImportExport
Magento_CatalogInventory
Magento_SampleData
Magento_Contact
Magento_Cookie
Magento_Cron
Magento_CurrencySymbol
Magento_CatalogSearch
Magento_CustomerImportExport
Magento_CustomerSampleData
Magento_Deploy
Magento_Developer
Magento_Dhl
Magento_Authorization
Magento_User
Magento_ImportExport
Magento_Sales
Magento_CatalogRule
Magento_Email
Magento_EncryptionKey
Magento_Fedex
Magento_GiftMessage
Magento_Checkout
Magento_GoogleAnalytics
Magento_GoogleOptimizer
Magento_GroupedImportExport
Magento_GroupedProduct
Magento_Tax
Magento_DownloadableImportExport
Magento_Braintree
Magento_Integration
Magento_LayeredNavigation
Magento_Marketplace
Magento_MediaStorage
Magento_ConfigurableProduct
Magento_MsrpSampleData
Magento_Multishipping
Magento_NewRelicReporting
Magento_Newsletter
Magento_OfflinePayments
Magento_SalesRule
Magento_OfflineShipping
Magento_PageCache
Magento_Captcha
Magento_Paypal
Magento_Persistent
Magento_ProductAlert
Magento_Weee
Magento_ProductVideo
Magento_CatalogSampleData
Magento_Reports
Magento_RequireJs
Magento_Review
Magento_BundleSampleData
Magento_Rss
Magento_DownloadableSampleData
Magento_Authorizenet
Magento_OfflineShippingSampleData
Magento_ConfigurableSampleData
Magento_SalesSampleData
Magento_ProductLinksSampleData
Magento_ThemeSampleData
Magento_ReviewSampleData
Magento_SendFriend
Magento_Ui
Magento_Sitemap
Magento_CatalogRuleConfigurable
Magento_Swagger
Magento_Swatches
Magento_SwatchesSampleData
Magento_GroupedProductSampleData
Magento_TaxImportExport
Magento_TaxSampleData
Magento_GoogleAdwords
Magento_CmsSampleData
Magento_Translation
Magento_Shipping
Magento_Ups
Magento_UrlRewrite
Magento_CatalogRuleSampleData
Magento_Usps
Magento_Variable
Magento_Version
Magento_Webapi
Magento_WebapiSecurity
Magento_SalesRuleSampleData
Magento_CatalogWidget
Magento_WidgetSampleData
Magento_Wishlist
Magento_WishlistSampleData
Sm_BasicProducts
Sm_Categories
Sm_Deals
Sm_ImageSlider
Sm_ListingTabs
Sm_Market
Sm_MegaMenu
Sm_QuickView

The issue was there long before I installed nosto, I initially installed SM quickstart then upgraded it the latest magento version. if I clear the cache from admin area, I see no error. I need to fix it otherwise I'll never be able to install any module or fix this

Update now I disabled nosto.

  • if the images are too big, please remove them and just leave a link to imgur instead – Lynob Jun 23 '16 at 21:03
  • @ProxiBlue no I havent, will try it this weekend and let u know, thanks for the info, i believe your solution will solve it – Lynob Jun 27 '16 at 14:09
  • I have had this issue, or variations of the same, many times whilst coding my first m2 module. In all instances, it was caused by my own code, usualky some issue in the module.xml. Considering that, i would venture some 3rd part moduke is havibg an issue. May need an update. Figure you will have to systematically disable 3rd party modules to find the culprit(s) – ProxiBlue Jun 27 '16 at 14:12
  • Sorry. Accidentalky deleted my comment. So just reposred. – ProxiBlue Jun 27 '16 at 14:13
  • @ProxiBlue thats fine and if a module can cause that then the error is definitely caused by a module since i'm using a custom magento version backed by SM market, it has its own theme and a trillion extension i don't know what for, seems i have to disable them 1 by 1 – Lynob Jun 27 '16 at 14:17

13 Answers 13

32

That error comes up when a module does not correctly declare its commands. It just stops Magento from correctly reading the wole commands list.

Unless you have broken third party modules, you probably have something left in your cache or generation folder preventing you to correctly run Magento commands.

From your Magento root:

rm -Rf var/cache/*
rm -Rf generated/* (or rm -Rf var/generation/* depending on your Magento version)

Then try again:

php bin/magento cache:flush

If it does not work just try to run:

php bin/magento

And see what is the last shown command.

| improve this answer | |
  • 1
    no it did not work and heres the output of php bin/magento pastebin.com/AknS0gV9 – Lynob Jun 23 '16 at 23:48
  • Did you turn on display_errors on CLI? – Phoenix128_RiccardoT Jun 24 '16 at 7:31
  • php -d display_errors bin/magento >log.txt no strage errors – Lynob Jun 24 '16 at 8:07
  • should i turn it on from php.ini? should i use magento verbose? – Lynob Jun 24 '16 at 8:08
  • Uhm... any 3rd part modules? – Phoenix128_RiccardoT Jun 27 '16 at 21:13
16

$ bin/magento module:enable --all

| improve this answer | |
  • This command will generate the app/etc/config.php file which contains all installed module and there activation status. – Cyclonecode Jan 13 '19 at 16:49
  • Works for me, all my modules where disabled because I installed via git and composer update – Black May 14 at 12:49
15

I have gone through the same problem. I have done same as you delete pub/static content but after re-deploying I didn't get the solutions. Again I installed fresh Magento. After some time again I face this issue but this time, I used the best approach. Hope this will work for you : Use the following command from your magento root directory

Step 1 - sudo rm -rf var/di/* var/generation/* var/cache/* var/page_cache/* var/view_preprocessed/* var/composer_home/cache/*
Step 2 - sudo chmod 777 var -R
Step 3 - sudo chmod 777 pub -R
Step 4 - sudo php bin/magento setup:static-content:deploy
Repeat step 2 & 3.

Please avoid 777 on the production server, but provide read and write permission for Magento.

| improve this answer | |
  • Thanks Lynob. Please can you paste your error here ? – Manish Jun 27 '16 at 14:16
  • 1
    same error, the steps didn't fix it, i guess some sort of a custom module is causing the issue – Lynob Jun 27 '16 at 14:28
  • 1
    Downvoted for 777 as a solution. – Vicary Nov 21 '17 at 18:28
10

it got same problem . i have been resolve by run this command :

php bin/magento

after done, it display the errors like as "Circular sequence reference ..." . With this errors,we only remove :

in etc/module.xml, because the module name already defined in module tag.

| improve this answer | |
  • same problem as question above... just add module.xml file. +1 your answer give me hint., – Ali Raza Oct 8 at 8:08
3

I had this issue once as well. Mine happened because I was doing a clean refresh

php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento setup:static-content:deploy php bin/magento indexer:reindex php bin/magento cache:clean

how I broke mine was I was rushed at work to go home and continue working not completing the steps thinking I could just ssh back into the server and finish. sure enough, I had to clear var/cache/* var/page_cache/* var/di/* var/generation/* and then run the process over again and everything worked fine.

just sharing my experience. hope it helps you in your troubleshooting.

| improve this answer | |
2

Try this,

  • sudo chmod -R 777 var
  • sudo chmod -R 777 pub
  • sudo php bin/magento setup:upgrade
| improve this answer | |
  • while this may help giving write permission to anything and everyone is NOT the way to go. Set the permissions correctly so that the correct use can write to these folders. – Andy Jul 19 '18 at 8:45
1

2nd answer after you updated your post:

According to your module:status output you have all the Magento core modules disabled. I've never seen this and I do not know how your admin is still working!

Anyway open your app/etc/config.php file and set all the modules starting with Magento_ to 1.

Example:

...
return array (
  'modules' => 
  array (
    ...
    'Magento_Store' => 1,
    'Magento_AdvancedPricingImportExport' => 1,
    'Magento_Directory' => 1,
    ...
...

After this, from you Magento root run:

rm -Rf var/cache/*
rm -Rf var/generation/*

And try again.

| improve this answer | |
1

I struggled with this for a while, not finding any information on these forums, until I finally figured it out. I had a 3rd party module that was not properly defined. I had the registration.php file in place, but I didn't have the etc\module.xml file. Instead of gracefully erroring out or ignoring the mis-configured module, it kills the entire Magento engine, including the CLI. I couldn't even run bin/magento module:status without it throwing the same error.

So, if this happens to you, and all other solutions fail, check that you don't have a misconfigured extension.

| improve this answer | |
1

I got same issue

[Symfony\Component\Console\Exception\CommandNotFoundException]
There are no commands defined in the "cache" namespace.

I checked in my source lost file etc/evn.php. Push on source and it be fixed.

| improve this answer | |
1

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

| improve this answer | |
1

Check if any of your newly created module's etc/module.xml file doesn't have any syntax errors.

| improve this answer | |
1

Finally, combining all tips from previous answers cache:flush worked for me:

1. rm -rf generated/code
2. rm -rf var/cache
3. rm -rf var/view_preprocessed
4. php -d memory_limit=-1 /usr/bin/composer install
5. php -d memory_limit=-1 bin/magento

If php -d memory_limit=-1 bin/magento cache:flush still doesn't work then continue...

6. php -d memory_limit=-1 bin/magento module:enable --all 
    #You can disable selected ones later if required.

Now try to run cache flush again.

7. php -d memory_limit=-1 bin/magento cache:flush

NOTE: I usually use php -d memory_limit=-1 on my local, so it's up to you to use that or not.

| improve this answer | |
0

I apply all the answer But not work. Then i start to check my code, in env.php file i found problem there. So please carefully to apply all the answer .

| improve this answer | |
  • 1
    Check module.xml file of your last installed extension. This error generally because of this file only – zuber bandi Apr 25 '19 at 6:09

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