Magento2 Setup version for module is not specified

In my case it was the file/folder permission of that module.

Apache couldn't read the configuration file.

Apply following permission to your module directory.

chmod 775 <module path> -R

Try

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

Assuming that you are run the current master branch and not dev branch


Reference source: https://magentoexplorer.com/magento-2-setup-version-for-module-is-not-specified-how-to-fix (in my case, i got this error when creating a new Magento 2 module)

You may encounter this error because of wrong module file/folder permission, you can change permission for module folder as follow

chmod 775 <module path> -R

There's another possibility that you forgot to add registration.php and composer.json in module. Try to add the following file

/app/code/Namespace/Module/registration.php

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

and /app/code/Namespace/Module/composer.json

{
    "name": "namespace/module",
    "description": "namespace",
    "require": {
      "php": "~5.5.0|~5.6.0|~7.0.0",
      "magento/framework": "100.0.*",
      "magento/module-ui": "100.0.*",
      "magento/module-config": "100.0.*",
      "magento/module-contact": "100.0.*"    
    },
    "type": "magento2-module",
    "version": "100.0.0",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "extra": {
        "map": [
            [
                "*",
                "Namespace/Module"
            ]
        ]
    },
    "autoload": {
        "files": [ "registration.php" ],
        "psr-4": {
            "namespace\\module\\": ""
        }
    }
}

Finally run these commands

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

Hope this helps!