There are no commands defined in the "cache" namespace

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.

Solutions

$ bin/magento module:enable --all

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.

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.

Tags: Magento 2.x / Admin / Cache

Similar questions

no commands defined in the “setup” namespace
[InvalidArgumentException] There are no commands defined in the "cache" namespace. I am using putty to run some commands. if I run php bin/magento setup:cache Is there any thing I missed during installation
Why is Magento trying to call in the Mage namespace rather than my custom namespace?
I’ve created a module within the local code folder in our custom namespace. The block isn’t displaying on the frontend, and on checking the exception log, it turns out Magento is looking in the wrong place. The same also goes if I exclude the MyCompany_ prefix when calling the block; it still looks in the Mage namespace. I have this in a file calle...
Is there a fast way to flush cache and empty static folders using putty commands?
Is there a fast way to flush cache and empty static folders using putty commands? I am in developer mode and sometimes I dont know what I need to do so that the site updates my edits. Can one combine commands in putty and run at once?
in magento controller file there is one get function is there "$mobile -> $model ->getphone();" where is that get phone method defined
in magento custom module controller file there is one get function is there for getting a phone number "$mobile -> $model ->getphone();" where is that get phone method defined.
how to use magento defined blocks in our defined new block as inner block
i have tried to use block as inner block which is defined in the same layout xml file using "as" in block tag and getchildhtml("as name") in phtml. test.php(layout file) file1.phtml similarly how can we use the magento defined blocks as inner blocks in our blocks for example magento defined Now i want to use as="left" in my block as inner block If ...
What's the difference between an user defined attribute and non user defined attribute?
I have an customer attribute defined as follows: My question is: what's the difference on the attribute if I set user_defined to false? And in which situations I should set user_defined to true or false?

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.