Hot answers tagged

118

to reindex in magento 2, go to the CLI and then the root folder of your magento installation and run the below command : php bin/magento indexer:reindex


81

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 something is going wrong, this will also give you a much more descriptive error message about how and why it is failing. This could be the result of an invalid ...


27

registration.php missing Apparently my Vendorname_Modulename module was missing the registration.php. I'm running the latest Magento2 version from GitHub. Every module has to register itself in the ComponentRegistrar. A typical registration.php for a module (in the root of your module) could contain: <?php use Magento\Framework\Component\...


26

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://gist.github.com/bka/d44fb33d1eaf780e1b76


22

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 indexer_name can be found by typing following command : php bin/magento indexer:info


17

You don't need the brackets when you run the command so you should run: sudo php bin/magento cron:run --group="customgroupname_cron"


17

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 specific job code for your cron and then trigger just that cron from the command line. It can easily be installed via composer require-dev n98/magerun2 and I ...


16

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:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Mastering_Itdesire" setup_version="1.0.1"> <...


15

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 then, we can test our Cron by calling the url directly on Browser. ** Note if using Nginx you can put these files in the pub/ folder and adjust the require path ...


14

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


12

"View" refers to presentation layer (from MVC). "Static" means it can be cached for a site (it's not dynamic). Eg CSS generated from LESS files. In production we can pre-compute the files. In developer mode we can generate on demand, but the rest is cached in a file for speed. So if you load a new module, it might load new JS, CSS, layout file, etc - so ...


12

It appears just to remove files (and print some output). With that flag set the stack contains: \Magento\Setup\Console\Command\AbstractModuleCommand::cleanup \Magento\Framework\App\State\CleanupFiles::clearMaterializedViewFiles which empties these directories (see \Magento\Framework\App\Filesystem\DirectoryList): DirectoryList::STATIC_VIEW == 'static' ...


12

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 your Problem.


10

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\Component\ComponentRegistrar::MODULE, 'My_Module', __DIR__ ); And create you module.xml file: <?xml version="1.0"?> <config xmlns:xsi="http://www....


10

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://local.magento.com/" --base-url-secure="https://local.magento2.com/" --admin-user="admin" --admin-password="admin123" --admin-email="pramod.kharade@example.com" --...


10

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 uses. Flushing a cache type purges the cache storage, which might affect other processes applications that are using the same storage. In short: Clean is a ...


9

Yes, you can do it using Batch program to delete it. Its to much faster than manually deletion of files. Create a batch file in your magento root dir [you can place it another location too]. You can create batch file using .bat extension. Right click on batch file and select edit [Open it into notepad] and Type following commands into that. del /s /q "E:...


9

In my case, it worked using sudo sudo bin/magento setup:upgrade EDIT 19/02/16 Actually, the "sudo" solution is more a workaround for bad permissions/ownership of Magento files. If you don't already have a Magento file system owner, create one and add it to the apache group. adduser magento passwd magento //CentOS usermod -g apache magento //Ubuntu ...


9

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 $data) { if(!isset($data['value']) || !defined($data['value'])) { throw new \InvalidArgumentException('Constant name is expected.'); } return ...


9

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 was being kicked. It's super common in M1 to just look at the first line of the error and work with that to figure out the solution, but in this case it was ...


8

I've run into this. The issue is that shell scripts extending Mage_Shell_Abstract inherit behaviour that applies PHP ini settings parsed from Magento's .htaccess file. Take a look at the method protected function _applyPhpVariables() in shell/abstract.php. Easiest fix, is to just edit .htaccess and comment out the php_value directives for execution_time ...


8

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 and later. bin/magento setup:di:compile-multi-tenant See: http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-compiler.html You can ...


8

In a case when your extension is in app/code folder you will get this error if your folder name is different than module name after Magento_ in module.xml for an example: if your module name is Magento_MyGreatModule your folder name must be MyGreatModule.


7

There are no commands defined is a generic message which hides a real problem. I have opened the issue stated that Magento 2 should clarify such messages, so please vote for it. In my cases the problem was with composer.json file and with an extension's module.xml file. See also: All There are no commands defined issues in the tracker. All There are no ...


7

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 following in no particular order: Application code generation (factories, proxies, and so on) Area configuration aggregation (that is, optimized ...


7

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: php bin/magento cache:flush Magento 2 static content deploy Command: php bin/magento setup:static-content:deploy Magento 2 check developer mode Command: ...


7

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.


7

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 php -d memory_limit=1024M bin/magento setup:di:compile rm -rf var/di var/generation/* var/view_preprocessed pub/static/* php bin/magento setup:static-content:...


7

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 to me. Maybe within a close test environment?


7

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


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