0

I have a custom module which is working perfectly in my local machine but while I am trying to enable my module in my magento 2store hosted in cPanel,

I am getting below error

> [email protected] [~/public_html]# **php bin/magento module:enable -v  BBC_ProductAdminAccess**

>ea-php-cli Copyright 2017 cPanel, Inc.

>  [Zend_Json_Exception]   Decoding failed: Syntax error
> Exception trace:  () at /home/bbcmanagement/public_html/vendor/magento/zendframework1/library/Zend/Json.php:97 Zend_Json::decode() at /home/bbcmanagement/public_html/vendor/magento/framework/Module/PackageInfo.php:85 Magento\Framework\Module\PackageInfo->load() at /home/bbcmanagement/public_html/vendor/magento/framework/Module/PackageInfo.php:208 Magento\Framework\Module\PackageInfo->getRequire() at /home/bbcmanagement/public_html/vendor/magento/framework/Module/DependencyChecker.php:132 Magento\Framework\Module\DependencyChecker->createGraph() at /home/bbcmanagement/public_html/vendor/magento/framework/Module/DependencyChecker.php:95 Magento\Framework\Module\DependencyChecker->checkDependencyGraph() at /home/bbcmanagement/public_html/vendor/magento/framework/Module/DependencyChecker.php:82 Magento\Framework\Module\DependencyChecker->checkDependenciesWhenEnableModules() at /home/bbcmanagement/public_html/vendor/magento/framework/Module/Status.php:97 Magento\Framework\Module\Status->checkConstraints() at /home/bbcmanagement/public_html/setup/src/Magento/Setup/Console/Command/AbstractModuleManageCommand.php:92 Magento\Setup\Console\Command\AbstractModuleManageCommand->execute() at /home/bbcmanagement/public_html/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257 Symfony\Component\Console\Command\Command->run() at /home/bbcmanagement/public_html/vendor/symfony/console/Symfony/Component/Console/Application.php:874 Symfony\Component\Console\Application->doRunCommand() at /home/bbcmanagement/public_html/vendor/symfony/console/Symfony/Component/Console/Application.php:195 Symfony\Component\Console\Application->doRun() at /home/bbcmanagement/public_html/vendor/magento/framework/Console/Cli.php:96 Magento\Framework\Console\Cli->doRun() at /home/bbcmanagement/public_html/vendor/symfony/console/Symfony/Component/Console/Application.php:126 Symfony\Component\Console\Application->run() at /home/bbcmanagement/public_html/bin/magento:23

>module:enable [-f|--force] [--all] [-c|--clear-static-content] [--magento-init-params="..."] [module1] ... [moduleN] }

app\code\BBC\ProductAdminAccess\composer.json

{"name": "bbc/sample-module-minimal",
  "description": "A module that creates a page in the Magento admin area",
  "type": "magento2-module",
  "version": "1.0.0",
  "license": [
    "OSL-3.0",
    "AFL-3.0"
  ],
  "require": {
    "php": "~5.6.0|7.0.2|7.0.4|~7.0.6"
  },
  "autoload": {
    "files": [ "registration.php" ],
    "psr-4": {
      "BBC\\ProductAdminAccess\\": ""
    }
  }}

app\code\BBC\ProductAdminAccess\registration.php

    <?php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'BBC_ProductAdminAccess',
    __DIR__);

I have checked the format of the json file using online format checker and it came out fine.

Please help Me with it.

enter image description here

4
  • check your composer.json file content. Commented Jun 4, 2018 at 13:49
  • @kunj : I have added the composer and registration.php code, can you take a look, I have checked the format of the json file using online format checker and it came out fine. Commented Jun 4, 2018 at 14:06
  • try this {"name": "bbc/product-admin-access", "description": "A module that creates a page in the Magento admin area", "type": "magento2-module", "version": "1.0.0", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { "php": "~5.6.0|7.0.2|7.0.4|~7.0.6" }, "autoload": { "files": [ "registration.php" ], "psr-4": { "BBC\\ProductAdminAccess\\": "" } }} Commented Jun 4, 2018 at 14:24
  • @kunj : It didn't worked, got the same error, anything else that you can suggest me. Commented Jun 5, 2018 at 19:43

1 Answer 1

1

I just tried the below code and it worked fine.

php bin/magento module:enable -f  BBC_ProductAdminAccess

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.