112 votes
Accepted

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 ...
Ryan Hoerr's user avatar
  • 12.3k
36 votes

Magento 2 - There are no commands defined in the "setup" namespace on windows

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://...
Khoa TruongDinh's user avatar
31 votes

Constant name is expected. Error

In order to help you debug what's going on, I would suggest to temporary edit the file vendor/magento/framework/Data/Argument/Interpreter/Constant.php From this... public function evaluate(array $...
rou6e's user avatar
  • 1,031
29 votes

Magento 2 run a specific Cron without cron:run CLI command?

On option to save in the development time would be to use N98MageRun for Magento 2. This has the wonderful commands sys:cron:list and sys:cron:run. Using these commands you will be able to find the ...
David Manners's user avatar
29 votes
Accepted

Magento 2: Disable all custom and Third Party Module in single Command

php bin/magento module:status | grep -v Magento | grep -v List | grep -v None | grep -v -e '^$'| xargs php bin/magento module:disable Credit : Toan Nguyen Source
Keyur Shah's user avatar
  • 18.1k
23 votes
Accepted

Magento 2 : Execute Cron

You don't need the brackets when you run the command so you should run: sudo php bin/magento cron:run --group="customgroupname_cron"
Raphael at Digital Pianism's user avatar
23 votes

Magento 2 compile command fail, but no errors

In app/bootstrap.php (line 11). Enable ini_set('display_errors', 1); Then run setup:di:compile again, you will see detail error message. It's already tested.
thienphucvx's user avatar
  • 1,334
22 votes

Magento 2 Reindexing - One or more indexers are invalid. Make sure your Magento cron job is running

Run this command in your CLI php bin/magento indexer:reindex and if you want to reindex only one indexer then write following command: php bin/magento indexer:reindex indexer_name. where ...
MaYaNk's user avatar
  • 1,730
20 votes
Accepted

Magento 2 run a specific Cron without cron:run CLI command?

Think simple! The Cron class is a "normal" class. We can use a Playground to test our Cron: How can I bootstrap Magento 2 in a test.php script?. The Object Manager will create our Cron Object. And ...
Khoa TruongDinh's user avatar
19 votes
Accepted

Constant name is expected. Error

I think some problem in your etc folder. check all xml files. Constant name should be in CAPITAL letters. any of your constant remain in small letters. check it and correct it. Hope this will solve ...
A chauhan's user avatar
  • 216
19 votes
Accepted

How to create custom Module Development in magento 2 from Scratch?

Namespace: Mastering\Itdesire 1.How to Create Module Mastering/Itdesire/etc/module.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
Pramod Kharade's user avatar
18 votes

Constant name is expected. Error

Edit, extra information: As explained below, please investigate folder names/case for your files, also make sure the class defined matches your file path. Incorrect folder case/names means the ...
masitko's user avatar
  • 281
17 votes

How to remove captcha in via terminal?

If you prefer to run commands instead of going to admin panel: Disable admin login captcha php bin/magento config:set admin/captcha/enable 0 Disable frontend captcha ( If form specific captcha is ...
Milan Chandro's user avatar
17 votes
Accepted

Magento2.3 setup:upgrade error

No need to update in core files, please follow up my solution. Open Mysql database and select database and use below queries. This query also will be useful to find out the datatype CHAR error when ...
ManiMaran A's user avatar
  • 1,136
15 votes
Accepted

How we can install magento 2.2.0 via command line comand?

php bin/magento setup:install --backend-frontname="admin" --key="admin" --session-save="files" --db-host="localhost" --db-name="magento_2_db" --db-user="root" --db-password="root" --base-url="http://...
Pramod Kharade's user avatar
13 votes

Magento2.3 setup:upgrade error

You are getting this error because "data type" of any third party extension's table column is enum. So you need to find out column name using debug in following file. See below file /vendor/magento/...
hardik's user avatar
  • 496
11 votes

Correct, Supported way to Add CLI Commands to Magento 2

The correct way is: Create your module as you do for any kind of module Just create your registration.php file \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\...
Phoenix128_RiccardoT's user avatar
11 votes
Accepted

PHP Fatal error: Uncaught Zend_Cache_Exception

I had to re-run permission commands on my magento 2 installation directory. Don't know why would I need to re-run them. sudo chmod -R 777 /var/www/html/mg Is this correct? Seems excessive permission ...
rits's user avatar
  • 753
11 votes
Accepted

Install Magento 2 on different mysql port

http://devdocs.magento.com/guides/v2.2/install-gde/install/cli/install-cli-install.html --db-host=localhost:3307 Note: You can optionally specify the database server port in its host name like ...
MagenX's user avatar
  • 3,820
10 votes

Magento 2 : Execute Cron

I merged the other answers from this post a bit - so that only one file is needed, and cron jobs can be run via browser or command line. Usage via command line: php cronLaunch.php "Vendor\Module\...
hey's user avatar
  • 1,137
10 votes
Accepted

Magento 2 "Area code not set" warning in 3rd party module

With some kind help i was able to track down the offending code. By using BuskaMuza's suggestion of adding verbose to bin/magento setup:upgrade -vvv i was able to track down the file where the error ...
circlesix's user avatar
  • 4,273
10 votes
Accepted

Magento 2 - bin/magento No commands working - Class 'Cli' not found Error

You are missing the composer.lock file and you must run the commands: composer update After you ran the above command, you can run the command: php bin/magento setup:upgrade
St3phan's user avatar
  • 2,907
10 votes

Magento2 which command Run and when to Run

Cleaning a cache type deletes all items from enabled Magento cache types only. In other words, this option does not affect other processes or applications because it cleans only the cache that Magento ...
Shoaib Munir's user avatar
  • 9,434
8 votes

magento 2 - In what case we need to run this command magento setup:di:compile?

During deployment (i.e. when changes were made to a system in production mode) Note that in production mode (versions 2.0.5 and earlier) you must use the "multi-tenant" compilation. Fixed in 2.0.6 ...
Fabian Schmengler's user avatar
8 votes
Accepted

Magento 2 - How to run fast command line setup:di:compile?

Well, unfortunately apart from improving your hardware there is no way you can make that command faster. This command is the Magento code compilation. Code compilation consists of all of the ...
Raphael at Digital Pianism's user avatar
8 votes

Is there a list of most popular CLI commands for Magento 2?

enter magento root via CLI compile & deploy when adding/changing modules, adjust language(s) as needed php bin/magento module:enable Vendor_Module Vendor_Module2 php bin/magento setup:upgrade ...
Joshua34's user avatar
  • 2,307
7 votes

Magento 2 Reindexing - One or more indexers are invalid. Make sure your Magento cron job is running

Here is how you can get things done using Magento 2 CLI indexing commands Get into your Magento CLI command file available in Magento/bin directory cd magento_folder/bin and run your command directly ...
Yogesh Trivedi's user avatar
7 votes

Magento2 CLI module:enable gives error "Unkown module(s)"

Adding to: If registration.php NOT missing Check and confirm if the module name in the module's etc/module.xml is correct(not the module name in <sequence> tag if present)
Binod Kalathil's user avatar
7 votes

Magento 2: Controlling M2 via command line – when and why to use each command

I am sharing some magento 2 useful commands here: Magento 2 Upgrade Command: php bin/magento setup:upgrade Magento 2 reindex Command: php bin/magento indexer:reindex Magento 2 flush cache Command:...
Purushotam Sharma's user avatar
7 votes

Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory

I hope this will help you If you are using wamp server on windows then C:\wamp\bin\php\php5.5.12>php.exe C:\wamp\www\<Magento root directory>\bin\magento setup:upgrade in your CLI.
MaYaNk's user avatar
  • 1,730

Only top scored, non community-wiki answers of a minimum length are eligible