cancel
Showing results for 
Search instead for 
Did you mean: 

Module not registering and causing CLI to fail

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Module not registering and causing CLI to fail

Hi,

I am in the early stages of test developing a Magento 2 extension - and I am having problems with registration of the module.  The confusing thing is (I think) I am following the same method that previously resulted in successful registration of the module!  Also, the presence of my registration.php file is causing the Magento CLI to fail.

I am hoping somebody can spot an obvious error/issue in what I am doing - or, failing that, give me some pointers on how to troubleshoot the issue.

 

I am working in Magento 2.04 CE

The OS is CentOS

SELinux is set to permissive

 

I have placed the composer.json and registration.php files in the root directory of my module.  They reside in directory ../app/code/vendorname/modulename     I also have a module.xml file in the  ../app/code/vendorname/modulename/etc  directory.

 

Content of the composer.json:  

{

  "name": “magemood/shareorder",

  "description": "A Magento 2 module that shares orders with other applications",

  "type": "magento2-module",

  "version": "1.0.0",

  "license": [

    "OSL-3.0",

    "AFL-3.0"

  ],

  "require": {

    "php": "~5.5.0|~5.6.0|~7.0.0",

    "magento/framework": "~100.0.4"

  },

  "autoload": {

    "psr-4": {“Magemood\\Shareorder\\": "" },

    "files":["registration.php"]

  }

}

 

The content of registration.php:

<?php

 

use \Magento\Framework\Component\ComponentRegistrar;

 

ComponentRegistrar::register(

    ComponentRegistrar::MODULE,

    'Magemood_Shareorder',

    __DIR__

);

 

As well as not resulting in successful registration of the module, the presence of these files causes the Magento CLI to fall over. The output from running magento CLI with -v flag:

 

[Zend\ServiceManager\Exception\ServiceNotCreatedException]                                                                                    

  An abstract factory could not create an instance of magentosetupconsolecommandmoduleuninstallcommand(alias: Magento\Setup\Console\Command\Mo 

  duleUninstallCommand).                                                                                                                        

                                                                                                                                                

Exception trace:

() at /var/www/magento2/vendor/zendframework/zend-servicemanager/src/ServiceManager.php:1135

Zend\ServiceManager\ServiceManager->createFromAbstractFactory() at /var/www/magento2/vendor/zendframework/zend-servicemanager/src/ServiceManager.php:646

Zend\ServiceManager\ServiceManager->doCreate() at /var/www/magento2/vendor/zendframework/zend-servicemanager/src/ServiceManager.php:598

Zend\ServiceManager\ServiceManager->create() at /var/www/magento2/setup/src/Magento/Setup/Console/CommandList.php:89

Magento\Setup\Console\CommandList->getCommands() at /var/www/magento2/vendor/magento/framework/Console/Cli.php:107

Magento\Framework\Console\Cli->getApplicationCommands() at /var/www/magento2/vendor/magento/framework/Console/Cli.php:84

Magento\Framework\Console\Cli->getDefaultCommands() at /var/www/magento2/vendor/symfony/console/Symfony/Component/Console/Application.php:91

Symfony\Component\Console\Application->__construct() at /var/www/magento2/vendor/magento/framework/Console/Cli.php:76

Magento\Framework\Console\Cli->__construct() at /var/www/magento2/bin/magento:24

                                                                                                                       

  [Zend\ServiceManager\Exception\ServiceNotCreatedException]                                                           

  An exception was raised while creating "Magento\Setup\Console\Command\ModuleUninstallCommand"; no instance returned 

                                                                                                                       

Exception trace:

() at /var/www/magento2/vendor/zendframework/zend-servicemanager/src/ServiceManager.php:946

Zend\ServiceManager\ServiceManager->createServiceViaCallback() at /var/www/magento2/vendor/zendframework/zend-servicemanager/src/ServiceManager.php:1129

Zend\ServiceManager\ServiceManager->createFromAbstractFactory() at /var/www/magento2/vendor/zendframework/zend-servicemanager/src/ServiceManager.php:646

Zend\ServiceManager\ServiceManager->doCreate() at /var/www/magento2/vendor/zendframework/zend-servicemanager/src/ServiceManager.php:598

Zend\ServiceManager\ServiceManager->create() at /var/www/magento2/setup/src/Magento/Setup/Console/CommandList.php:89

Magento\Setup\Console\CommandList->getCommands() at /var/www/magento2/vendor/magento/framework/Console/Cli.php:107

Magento\Framework\Console\Cli->getApplicationCommands() at /var/www/magento2/vendor/magento/framework/Console/Cli.php:84

Magento\Framework\Console\Cli->getDefaultCommands() at /var/www/magento2/vendor/symfony/console/Symfony/Component/Console/Application.php:91

Symfony\Component\Console\Application->__construct() at /var/www/magento2/vendor/magento/framework/Console/Cli.php:76

Magento\Framework\Console\Cli->__construct() at /var/www/magento2/bin/magento:24

                                 

  [Zend_Json_Exception]          

  Decoding failed: Syntax error 

 

Exception trace:

() at /var/www/magento2/vendor/magento/zendframework1/library/Zend/Json.php:97

Zend_Json::decode() at /var/www/magento2/vendor/magento/framework/Module/PackageInfo.php:85

Magento\Framework\Module\PackageInfo->load() at /var/www/magento2/vendor/magento/framework/Module/PackageInfo.php:208

Magento\Framework\Module\PackageInfo->getRequire() at /var/www/magento2/vendor/magento/framework/Module/DependencyChecker.php:132

Magento\Framework\Module\DependencyChecker->createGraph() at /var/www/magento2/vendor/magento/framework/Module/DependencyChecker.php:53

Magento\Framework\Module\DependencyChecker->__construct() at /var/www/magento2/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:101

Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject() at /var/www/magento2/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:89

Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() at /var/www/magento2/vendor/magento/framework/ObjectManager/ObjectManager.php:71

Magento\Framework\ObjectManager\ObjectManager->get() at /var/www/magento2/setup/src/Magento/Setup/Console/Command/ModuleUninstallCommand.php:140

Magento\Setup\Console\Command\ModuleUninstallCommand->__construct() at n/a:n/a

ReflectionClass->newInstanceArgs() at /var/www/magento2/vendor/zendframework/zend-di/src/Di.php:495

Zend\Di\Di->createInstanceViaConstructor() at /var/www/magento2/vendor/zendframework/zend-di/src/Di.php:298

Zend\Di\Di->newInstance() at /var/www/magento2/vendor/zendframework/zend-di/src/Di.php:247

Zend\Di\Di->get() at /var/www/magento2/vendor/zendframework/zend-servicemanager/src/Di/DiServiceFactory.php:103

Zend\ServiceManager\Di\DiServiceFactory->get() at /var/www/magento2/vendor/zendframework/zend-servicemanager/src/Di/DiAbstractServiceFactory.php:43

Zend\ServiceManager\Di\DiAbstractServiceFactory->createServiceWithName() at n/a:n/a

call_user_func() at /var/www/magento2/vendor/zendframework/zend-servicemanager/src/ServiceManager.php:939

Zend\ServiceManager\ServiceManager->createServiceViaCallback() at /var/www/magento2/vendor/zendframework/zend-servicemanager/src/ServiceManager.php:1129

Zend\ServiceManager\ServiceManager->createFromAbstractFactory() at /var/www/magento2/vendor/zendframework/zend-servicemanager/src/ServiceManager.php:646

Zend\ServiceManager\ServiceManager->doCreate() at /var/www/magento2/vendor/zendframework/zend-servicemanager/src/ServiceManager.php:598

Zend\ServiceManager\ServiceManager->create() at /var/www/magento2/setup/src/Magento/Setup/Console/CommandList.php:89

Magento\Setup\Console\CommandList->getCommands() at /var/www/magento2/vendor/magento/framework/Console/Cli.php:107

Magento\Framework\Console\Cli->getApplicationCommands() at /var/www/magento2/vendor/magento/framework/Console/Cli.php:84

Magento\Framework\Console\Cli->getDefaultCommands() at /var/www/magento2/vendor/symfony/console/Symfony/Component/Console/Application.php:91

Symfony\Component\Console\Application->__construct() at /var/www/magento2/vendor/magento/framework/Console/Cli.php:76

Magento\Framework\Console\Cli->__construct() at /var/www/magento2/bin/magento:24

 

Also,  if I try running something like:    php bin/magento module:status -v

 

I get:  

[InvalidArgumentException]                                

  There are no commands defined in the "module" namespace. 

                                                            

Exception trace:

() at /var/www/magento2/vendor/symfony/console/Symfony/Component/Console/Application.php:501

Symfony\Component\Console\Application->findNamespace() at /var/www/magento2/vendor/symfony/console/Symfony/Component/Console/Application.php:535

Symfony\Component\Console\Application->find() at /var/www/magento2/vendor/symfony/console/Symfony/Component/Console/Application.php:192

Symfony\Component\Console\Application->doRun() at /var/www/magento2/vendor/magento/framework/Console/Cli.php:49

Magento\Framework\Console\Cli->doRun() at /var/www/magento2/vendor/symfony/console/Symfony/Component/Console/Application.php:126

Symfony\Component\Console\Application->run() at /var/www/magento2/bin/magento:25

 

Any help much appreciated...