We have a Drupal 8 application which has modules directly in the directory "/modules" on the file system. I want to move a contributed module from the directory "/modules" to the directory "/modules/contrib". Do I need to uninstall the module before doing it?

Are there any steps that need to be performed before and after moving the module?

  • You probably have to regenerate the autoloader files and dump any running memory cache. – Kevin Jan 17 '19 at 22:22
  • @Kevin How can we regenerate the autoloader files? And would clearing the cache through the admin interface by going to '/admin/config/development/performance', dump the running memory cache? – Martin Borugadda Jan 17 '19 at 22:28
  • composer dump-autoload @MartinBorugadda, and yes (or run drush cr) – Clive Jan 17 '19 at 23:06
  • Why don't you simply try it out yourself on your local machlne? – leymannx Jan 18 '19 at 0:11
  • 1
    Possible duplicate of Moving module location – leymannx Jan 18 '19 at 7:03

As with most things, I suggested testing it out on a development/test site before trying on the live site. It's likely that the specific set of contribs and the libraries they use will affect the success of this operation.

How did you install the modules? Do you use a composer workflow?

In general, some paths stored in different places are going to be wrong. To fix that, you will need to edit those paths or have Drupal figure out the new paths. I believe doing a cache rebuild (e.g. drush cr) will fix that problem.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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