Whenever I run the common commands I get this and similarly named errors:

  There are no commands defined in the "deploy:mode" namespace.

Im using Magento 2.2.5

  • In terminal other command work like cache clear and indexing ? Aug 9, 2018 at 5:06

7 Answers 7


For me, the resolution was to compile: bin/magento setup:di:compile. If that seems to do nothing or acts like it completes part of the way through, try increasing your memory limit: php -dmemory_limit=5G bin/magento setup:di:compile. Once I had compiled, I could set the deploy mode.


Try by enabling developer mode

php bin/magento deploy:mode:set developer


Run Following steps to check & then try again:

  1. Run “composer install” in magento root
  2. please use the -v or -vv option in the command line for debug information.
  3. If an extension has no etc/module.xml file then bin/magento fails.
  4. If a composer.json has a syntax error.

I hope it helps!


First, remove generated directory and execute

php bin/magento setup:di:compile

provide permission 777 to generated directory.

now please check your Magento commands


Not having a proper content in app/etc/env.php / missing the default db connection array node can also cause the deploy:mode command to be missing from bin/magento, along with many other commands. Check that you have a properly defined .env file, comparing to .env.dist. The behaviour of missing commands, can be replicated quickly (at least on Magento 2.3.6) by emptying .env file as such

    return [

or removing just the default node from the db/connection node

'db' => [
        'table_prefix' => '',
        'connection' => [
            'default' => [

in the .env file.


Just flush your redis cache. This is the problem.

redis-cli FLUSHALL

It might be a permission issue. You can run these commands under your Magento directory :

sudo chmod 775 -R ./generated/ ./var/ ./pub/

  • It did not. I got this error: [Symfony\Component\Console\Exception\CommandNotFoundException] There are no commands defined in the "deploy:mode" namespace. Aug 8, 2018 at 19:12
  • @MatthewMcLennan i updated my answer , you can check it
    – sami23
    Aug 8, 2018 at 19:32
  • 1
    Never give permission like above,because it should be like sudo chmod 777 -R var/
    – Jaisa
    Dec 14, 2018 at 7:25
  • Please put slash after var. don't use it before
    – Jaisa
    Dec 14, 2018 at 7:26

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.