1

I have installed magento2 on my ubuntu system. Its worked fine. Then i have created a simple module in magento2. After that i am getting the following error

a:4:{i:0;s:66:"Setup version for module 'Sample_CustomControllers' is not specified";i:1;s:3170:"#0 /opt/lampp/htdocs/Magento2/vendor/magento/framework/Module/DbVersionInfo.php(56): Magento\Framework\Module\DbVersionInfo->isModuleVersionEqual('Sample_CustomCont...', false)
#1 /opt/lampp/htdocs/Magento2/vendor/magento/framework/Module/DbVersionInfo.php(79): Magento\Framework\Module\DbVersionInfo->isSchemaUpToDate('Sample_CustomCont...')
#2 /opt/lampp/htdocs/Magento2/vendor/magento/framework/Module/Plugin/DbStatusValidator.php(55): Magento\Framework\Module\DbVersionInfo->getDbVersionErrors()
#3 [internal function]: Magento\Framework\Module\Plugin\DbStatusValidator->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#4 /opt/lampp/htdocs/Magento2/vendor/magento/framework/Interception/Chain/Chain.php(68): call_user_func_array(Array, Array)
#5 /opt/lampp/htdocs/Magento2/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'front-controlle...')
#6 /opt/lampp/htdocs/Magento2/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(68): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#7 [internal function]: Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#8 /opt/lampp/htdocs/Magento2/vendor/magento/framework/Interception/Chain/Chain.php(68): call_user_func_array(Array, Array)
#9 /opt/lampp/htdocs/Magento2/vendor/magento/framework/Interception/Interceptor.php(136): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'front-controlle...')
#10 /opt/lampp/htdocs/Magento2/vendor/magento/module-page-cache/Model/App/FrontController/VarnishPlugin.php(55): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#11 [internal function]: Magento\PageCache\Model\App\FrontController\VarnishPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#12 /opt/lampp/htdocs/Magento2/vendor/magento/framework/Interception/Interceptor.php(141): call_user_func_array(Array, Array)
#13 /opt/lampp/htdocs/Magento2/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#14 /opt/lampp/htdocs/Magento2/vendor/magento/framework/App/Http.php(115): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#15 /opt/lampp/htdocs/Magento2/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#16 /opt/lampp/htdocs/Magento2/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#17 {main}";s:3:"url";s:10:"/Magento2/";s:11:"script_name";s:19:"/Magento2/index.php";}

I have specified the setup version and all in the modules etc/module.xml file. When i searched this error i got a link in that they are telling to run the following commands

php -f bin/magento module:enable --clear-static-content Module_Name
php -f bin/magento setup:upgrade

But when i tried to run the second command i am getting another error

 [PDOException]                                                                                               
  SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

How can i solve my custom issue in my magento2 custom module Thanks in advance

2
  • how does your module.xml look like?
    – Marius
    Jun 21, 2016 at 12:11
  • <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> <module name="Sample_CustomControllers" setup_version="1.0.0"></module> </config> This is my module.xml file
    – amesh
    Jun 21, 2016 at 12:35

1 Answer 1

1

I also came across to same problem several times. It seems your file looks right but can you recheck the error after giving permission to app/code/<VendorModule> folder.

For reference you can check the sample module provided by Magento Team Itself.

Your Answer

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

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