4

Download

Today I downloaded the Magento 2.0 Full Release from the Magento website. I downloaded the Full Release with Sample Data (ZIP with sample data) and installed it. I wanted to test if my custom module build in RC-1 was still working however when I tried to enable the module I got an error.

Module installation

When I wanted to install my custom module I noticed the app/code directory disappeared and after a few clicks found that this was moved to the vendor directory. I assumed this was done by composer so decided to add my module to the composer.json in the document root. Running composer update installed the module to the vendor directory.

Error

Tried to enable module by executing the following command from my root directory:

PHP -f bin/magento module:enable --clear-static-content Test_Module

http://devdocs.magento.com/guides/v2.0/extension-dev-guide/enable-module.html

Unfortunately, I get the following error; anyone has an idea what goes wrong?

[InvalidArgumentException]
There are no commands defined in the "module" namespace.

2

Giving full control (read/write/execute) to var and pub directory solved this issue for me.

sudo chmod -R 777 var pub

Or, you may also try running the command using sudo.

sudo php -f bin/magento module:enable --clear-static-content Test_Module
1

For now I have fixed it by doing it without composer. I manually created a code directory within the app directory in the Magento root. Here I added the module in /Vendorname/Modulename which did the trick.

Not really the way I wanted to do it but for now It will have to do. If someone has a better answer and can tell me why what I did wrong for the composer way, please let me know.

1

In my case, there were errors in the schema path in my module.xml file, and also some commented lines in composer.json that Magento 2 didn't like. Once I cleared those up, the modules registered.

For example, in module.xml, the path to the schema xsd was incorrect. Some people have the path as this:

../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd

(note the letter casing!)

where it should have been

../../../../../vendor/magento/framework/Module/etc/module.xsd

There was also schema_version="1.0.0" in the module node that was deprecated(?), so I removed it.

Also, there is a "suggest" element in the composer.json object that I didn't need and had commented out with slashes, which caused an error.

Once I cleared those up, everything registered correctly.

  • I faced similar issue as I had schema_version in my module.xml file. To make it work i replaced it with setup_version – Mukesh Mar 21 '17 at 13:22
0

I had the same issue and I followed several suggested stupid suggestions to fix the problem like delete my composer.json something like that. But those didn't fix my problem. Today, I faced the problem again and I tried a new approach to trace the problem. All details and screenshot are in my personal blog post http://david.firstbiz.cc/blog_detail.php?id=115 I described my steps here:

  1. for CLI, please append "-vvv" and it will display function trace paths
  2. try to load any product page and check your web server error log and you will be able to see more details.
  3. the class name and the filename should be same (*this is the case I faced)

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.