I am brand new to Magento. I have read the thread at Magento2 CLI module:enable gives error "Unkown module(s)" which details essentially the same issue, though that hasn't exactly helped me in my situation. One of the answers looks potentially useful, mentioning auto-loading via composer json files, but I am unfortunately not finding that information to be clear.

I am wondering if (part of) my issue is path related.

Here is a look at the module I've created, the registration.php, and the command I ran to enable the module.

Again, I am brand new to Magento. I'm not even 100% what I expect to happen upon enabling this test module, though I'd like to get past this particular error. Help is greatly appreciated; please let me know if I can provide more information.

root@magento-1gb-nyc3-01:/var/www/html/magento# cat /var/www/html/magento/vendor/magento/magento2-base/app/code/Training/Test/etc/module.xml
<?xml version ="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    <module name="Training_Test" setup_version="2.0.0">
root@magento-1gb-nyc3-01:/var/www/html/magento# cat /var/www/html/magento/vendor/magento/magento2-base/app/code/Training/Test/registration.php
root@magento-1gb-nyc3-01:/var/www/html/magento# pwd
root@magento-1gb-nyc3-01:/var/www/html/magento# php bin/magento --clear-static-content module:enable Training_Test
Unknown module(s): 'Training_Test'
  • The answer by Andrew Noble was correct. I created a code dir under /var/www/html/magento/app and then moved the contents of the Training dir into said code directory. module:enable was then successful. Commented Feb 19, 2017 at 3:54

1 Answer 1


The issue is where you tried to create your module.

Any modules you write, need to go into the app/code folder. The vendor folder is only used for storing 3rd party modules that are installed via composer.

You should move your code to the following location:


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