"Failed to instantiate component or class" when calling Craft module I created a module with the pluginfactory generator. The module is used for generating a zip file with all the files belonging to a project.

In the composer.json file, I added the following:

"autoload": {
    "psr-4": {
      "zipassetscraft3module\\": "modules/zipassetscraft3module"
    }
  },


in the config/app.php I added:

'modules' =&gt; [
      'zip-assets-craft-3-module' =&gt; \modules\zipassetscraft3module\ZipAssetsCraft3Module::class,
    ],


In the file controllers/DefaultController.php I added a function called actionDownload() as well as a download() function in the file services/ZipAssetsCraft3ModuleService.php

On the website I have a form with the following url as action: https://default.com/actions/zip-assets-craft-3-module/default/download

When I submit the form, I get an error:


  Invalid Configuration – yii\base\InvalidConfigException Failed to
  instantiate component or class
  "modules\zipassetscraft3module\ZipAssetsCraft3Module".
  
  Caused by: ReflectionException Class
  modules\zipassetscraft3module\ZipAssetsCraft3Module does not exist


I have dumped the composer autoload, but I don't know why it's not working. Any ideas what I need to change to get this working?

This is the file structure of the module: 


So the error message says, there is a class missing, in which file is this class looked for?
I came across the same issue. So how i solved it is to modify the modules array like this and now the module is loading:

return [
    'modules' =&gt; [
        'zip-assets-craft-3-module' =&gt; [
            'class' =&gt; \modules\zipassetscraft3module\ZipAssetsCraft3Module::class,
        ],
    ],
    'bootstrap' =&gt; ['zip-assets-craft-3-module'],
];