0

I am trying to uninstall Lightning. When I run drush pm:uninstall lightning, it throws this error.

In PmCommands.php line 196:

lightning: The Lightning module is required

How can I resolve this?

1 Answer 1

4

Lightning is a distribution, not a module. Distributions and installation profiles cannot be uninstalled, once used to create a site. That's why the Lightning distribution hooks into the drush pm:uninstall command to make it possible.

If you aren't getting any Welcome to the $profile name uninstaller! message, it means the installed Lightning distribution needs to be first updated, as Uninstalling Lightning suggests.

  • If you're using Lightning 3, use the latest 3.4.x version.
  • If you're using Lightning 4, use the latest 4.1.x version.
  • If you're using Lightning 5, use the latest 5.2.x version.
  • If you're using Headless Lightning, use the latest 1.9.x version.

That page gives also other suggestions, for example the following one, for the commands that need to be executed before drush pm:uninstall lightning.

If you're using BLT and drush status --fields=install-profile reports that you're directly using the lightning or headless_lightning profiles, edit blt/blt.yml and change the profile key to minimal. Do NOT do this if you're using a sub-profile of Lightning or Headless Lightning.

As for running drush pm:uninstall lightning, these are the suggestions given for that.

Run drush pm:uninstall lightning to use the automated uninstall tool, which will ensure that Lightning can be uninstalled safely by making the necessary code and configuration changes. If you're using a sub-profile of Lightning, you can allow the uninstaller to decouple all sub-profiles automatically by answering the prompt, or see "Decoupling a sub-profile from Lightning" below to do it manually (all sub-profiles, in use or not, must be decoupled from Lightning before you continue). IMPORTANT: If you're using Headless Lightning or a sub-profile of it, run drush pm:uninstall headless_lightning BEFORE running drush pm:uninstall lightning.

After running drush pm:uninstall lightning, the next step is the following one.

Export config, then commit all changes and deploy them to your hosting. At a minimum, you should expect to see changes in your project-level composer.json and core.extension config.

When Lightning hooks into the drush pm:uninstall command, it executes the following commands, which essentially switch the profile from Lightning to another one.

  • drush pm:enable profile_switcher
  • drush switch:profile $profile

I didn't find any reference to the Profile Switcher module, in the Lightning distribution, despite it is necessary to switch the installation profile, which makes possible to uninstall the distribution. (Otherwise, drush pm:uninstall lightning would return the The Lightning module is required error.)
If updating the distribution doesn't install it, I would manually install it.

Also, the Lightning hook adds a required option to drush pm:uninstall, profile, which the installation profile to use instead of the distribution. If after updating the Lightning distribution and following the suggestions given in Uninstalling Lightning, you get an error about the profile option not found or required, try running drush pm:uninstall lightning --profile='default' instead of drush pm:uninstall lightning, which would pass the profile option to the command and the hook added by the distribution.

15
  • Thanks @apaderno I followed your steps and did drush pm:enable profile_switcher but when i try drush switch:profile $profile i get "Not enough arguments (missing: "profile_to_install")." Could you please advise on this Aug 22, 2021 at 11:34
  • I am following this github.com/acquia/lightning/wiki/Uninstalling-Lightning i ticked all the prerequisites and i upgraded from lightning 4.1.11 to 4.1.2. Aug 22, 2021 at 11:36
  • 1
    Truly, the latest 4.1.x version is release 8.x-4.117, released on August 12, 2021.
    – apaderno
    Aug 22, 2021 at 11:58
  • 1
    It must be a profile that already exists. If you plan to use a contributed installation profile, or distribution, you need to first download it and copy its files in the site directory. Standard is one of the installation profiles that comes with Drupal core, so you don't need to download anything, but you can use any installation profile / distribution.
    – apaderno
    Aug 22, 2021 at 12:02
  • 1
    Profile name Standard exists in the core folder as you mentioned. When entering the profile name using Drush I entered it with capital S instead of small does that make any difference as it's a machine name? Now that I am unable to do anything i can not clear caches using Drush or anything for anything I enter it shows The profile Standard does not exist. I even tried to uninstall it but nothing is working Aug 22, 2021 at 23:16

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.