Using the drupal console I created a module in a /sites subdirectory - because I want that module to be available only during development.

The creation process worked.

I tried to create a controller using the console and it said there was no such module. I tried enabling the module: no such module. Using:

drupal debug:module --type=no-core

listed the one other module I've created which is in /modules.

(Yes, I cleared caches.)

  • If you created a module under /sites/SITE A/modules/ then it won't display in root drupal folder. You have to go under sites/SITE A and list down modules there.
    – Ajay Reddy
    Commented May 25, 2018 at 10:51

1 Answer 1


The only valid places for modules to live are:

  • /modules
  • /sites/foo_site/modules/ (modules here will only be available when you list modules for that site specifically)
  • /profiles/foo_profile/modules (modules here will only be available when the site has been installed with this profile)

Anywhere else and Drupal won't find them. There's more information on the Installing Drupal 8 Modules page.

Disabling a module for a particular environment is something different, you handle it with configuration management rather than file system paths.

See How to prevent devel module to be installed on production enviroments? for the full picture.

  • This I know, and that's what "created a module in a /sites subdirectory" says. it's in a /sites/foo_site/modules directory. Commented May 25, 2018 at 10:54
  • OK. I looked it up. Got the picture. Commented May 25, 2018 at 11:01

Your Answer

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

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