Score:0

Uninstalling Lightning causes an error

in flag

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?

Score:4
us flag

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.

Akshar Vijay avatar
in flag
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
Akshar Vijay avatar
in flag
I am following this https://github.com/acquia/lightning/wiki/Uninstalling-Lightning i ticked all the prerequisites and i upgraded from lightning 4.1.11 to 4.1.2.
apaderno avatar
us flag
You need to put the profile name, instead of `$profile`, for example `drush switch:profile 'standard'`. I used `$profile` as placeholder.
apaderno avatar
us flag
Version 4.1.11 is more recent than version 4.1.2. If you had version 4.1.11 installed and you installed version 4.1.2, you down-graded instead of upgrading.
apaderno avatar
us flag
Truly, the latest 4.1.x version is [release 8.x-4.117](https://www.drupal.org/project/lightning/releases/8.x-4.117), released on August 12, 2021.
Akshar Vijay avatar
in flag
Thanks Can i give anything as the profile name or is it something that should be already existing in my code folder? May i know whats the recent version of lightning 4 . I followed this https://docs.acquia.com/lightning/release-notes/
apaderno avatar
us flag
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.
Akshar Vijay avatar
in flag
Thanks for letting me know about the versions i have updated lightning to 4.1.17 but now when i try uninstall lightning it says that the profile Standard does not exist. So should i use a contributed installation profile or disturbtion? I had actually enabled the profile switcher and gave the name as Standard and should it be $Standard ?
apaderno avatar
us flag
The profile name is *Standard* and its machine name is *standard*. Check the *core/profiles/standard/standard.profile* file exists. If it doesn't exist, you need to download the Drupal core files.
Akshar Vijay avatar
in flag
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
Akshar Vijay avatar
in flag
In settings.global.php this has already been commented #$settings['install_profile'] = ''; I cam across this suggestion in issues raised in Drupal.org
Akshar Vijay avatar
in flag
Should I update profile_switcher ? similar to this https://drupal.stackexchange.com/questions/291522/error-the-module-ldap-does-not-exist-after-composerizing-project
apaderno avatar
us flag
The latest release of the *Profile Switcher* module has been released on November 24, 2020. You should not have an outdated release. Just to be sure, check the release you installed is 8.x-1.0-alpha5 and update it if it's a previous version. I would also try setting `$settings['install_profile']` to `'standard'`.
Akshar Vijay avatar
in flag
Profile Switcher has the latest version and i uncommented and set it to ```$settings['install_profile'] = 'standard'``` but its still throwing the same error.
Akshar Vijay avatar
in flag
I followed the instructions that you had suggested. its still throwing the same error as ```Standard does not exist```.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.