A profile is like a module or theme, you have to uninstall it first before you can remove it from the file system. Additionally a profile can't just be uninstalled like a module. You need to switch the profile. This module might be helpful:
Profile Switcher
This module provides a Drush command to switch between install
profiles found in /profile directory:
drush switch:profile [new-profile]
This is useful for moving an existing site to distribution or moving
from an abandoned distribution back to a standard Drupal core install.
https://www.drupal.org/project/profile_switcher
See the warnings, though:
IMPORTANT WARNINGS:
- Switching profiles is NOT a trivial change like switching a theme.
- ALWAYS test before using on a live site and ALWAYS have a backup
Recover broken site
After moving the profile back to web/profiles
you can recover a broken site by resetting the extension profile list:
drush ev "\Drupal::service('extension.list.profile')->reset();"
This not only clears the relevant cache entries but also the key system.profile.files
stored in the State API.
Instead of the drush command you can clear the cache_
tables and the entry system.profile.files
in the collection state
from the key_value
table:
delete from 'key_value' where collection = 'state' and name = 'system.profile.files';