If you encounter a vendor directory related permission denied error after running drush updb or drush updatedb in Drupal 10 similar to:
In SiteProcess.php line 214:
The command "/home/account/public_html/vendor/bin/drush updatedb:status --strict=0 --uri=de fault" failed. Exit Code: 126(Invoked command cannot execute) Working directory: Output: ================ Error Output: ================ sh: /home/account/public_html/vendor/bin/drush: Permission denied
it may be that Drush is either not installed correctly or the permissions are not set.
you may do all or any of the following:
Check if Drush is present in composer.json
If not, run the following commands in your local environment:
composer config vendor-dir vendor
composer require drush/drush
It will now configure vendor directory and install or re-install necessary drush libraries and dependencies:
./composer.json has been updated Running composer update drush/drush Loading composer repositories with package information Updating dependencies Lock file operations: 6 installs, 1 update, 0 removals - Upgrading drush/drush (12.5.3 => 13.3.3) - Locking illuminate/collections (v11.34.2) - Locking illuminate/conditionable (v11.34.2) - Locking illuminate/contracts (v11.34.2) - Locking illuminate/macroable (v11.34.2) - Locking laravel/prompts (v0.1.25) - Locking psr/simple-cache (3.0.0) Writing lock file Installing dependencies from lock file (including require-dev) Package operations: 6 installs, 1 update, 0 removals - Downloading illuminate/contracts (v11.34.2) - Downloading illuminate/conditionable (v11.34.2) - Downloading illuminate/collections (v11.34.2) - Downloading drush/drush (13.3.3) - Installing illuminate/macroable (v11.34.2): Extracting archive - Installing psr/simple-cache (3.0.0): Extracting archive - Installing illuminate/contracts (v11.34.2): Extracting archive - Installing illuminate/conditionable (v11.34.2): Extracting archive - Installing illuminate/collections (v11.34.2): Extracting archive - Installing laravel/prompts (v0.1.25): Extracting archive - Upgrading drush/drush (12.5.3 => 13.3.3): Extracting archive Generating autoload files 98 packages you are using are looking for funding. Use the `composer fund` command to find out more! phpstan/extension-installer: Extensions installed No security vulnerability advisories found. Using version ^13.3 for drush/drush
Regenerate Vendor directory (optional)
Sometimes at this point running drush updb will already work, but if it still does not, it may be that vendor/bin still does contain a symlink to Drush, you can try regenerating the entire vendor directory again:
rm -rf vendor
composer install
Or, alternatively, manually create the Drush symlink in vendor/bin as long as vendor/drush/drush/drush has already been installed using Composer:
cd vendor/bin
ln -s drush ../drush/drush/drush
