Update Extensions page error if Composer not found

Created on 20 January 2025, 2 months ago

Problem/Motivation

Installed Drupal on a shared hosting server where it couldn't find the Composer executable.
On the Extend page most tabs show an error message that Composer can't be found.

The Extend->Update Extensions tab has an uncaught exception instead.
The exception is "PhpTuf\ComposerStager\API\Exception\LogicException: The composer executable cannot be found. Make sure it's installed and in the $PATH in PhpTuf\ComposerStager\Internal\Finder\Service\ExecutableFinder->find() (line 34 of [path-to]/vendor/php-tuf/composer-stager/src/Internal/Finder/Service/ExecutableFinder.php)."

Composer is installed and was used to get the Drupal files. I don't know why it couldn't find the Composer executable, my guess is it's a permissions issue?

Steps to reproduce

Install Drupal
Make sure Composer isn't in the $PATH
Check Extend->Update for message that the Composer executable can't be found
Go to Extend->Update Extensions tab - this will give an exception

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.1 πŸ”₯

Component

package_manager.module

Created by

πŸ‡¦πŸ‡ΊAustralia juxe

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @juxe
  • πŸ‡³πŸ‡ΏNew Zealand quietone

    Changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to the Core change policies β†’ .

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    The "Update Extensions" page is actually not in core; it's part of the contributed Automatic Updates module. (Package Manager has no UI at all.) Moving to the appropriate issue queue.

  • πŸ‡¬πŸ‡§United Kingdom catch

    Since this is a user facing fatal error, bumping to critical.

    We might need a second issue to try to investigate further why the executable can't be found too.

  • πŸ‡³πŸ‡¬Nigeria chike Nigeria

    Same issue here.

    I installed Drupal CMS on a shared hosting server and visiting 'Browse' shows the error,

    Unable to download modules via the UI: The composer executable cannot be found. Make sure it's installed and in the $PATH

  • πŸ‡³πŸ‡¬Nigeria chike Nigeria

    I tried to place a copy of composer.phar on my host server but that didn't work. This is what I did.

    I navigated to the root of my host account where I have vendor folder then I ran the following commands:

    curl -sS https://getcomposer.org/installer | php

    chmod +x composer.phar

    Then I added this in settings.php,

    $settings['composer_executable'] = '/home/username/composer.phar';

    This doesn't work.

  • πŸ‡³πŸ‡¬Nigeria chike Nigeria

    I am sorry my issue is not really what this issue is all about - only related.

  • πŸ‡§πŸ‡·Brazil btriest

    I have the same issue here.

    I installed Drupal CMS on a shared hosting as well and visiting 'Browse' shows the error,

    Unable to download modules via the UI: The composer executable cannot be found. Make sure it's installed and in the $PATH

  • πŸ‡΅πŸ‡ΉPortugal joaomachado

    I too installed DruaplCMS on a shared host with the same error. Now,

    I have been using Drupal since version 6, in fact, because of the SUPER user friendliness of the project, I was able to make a powerful vehicle tracking system for the company I worked for then, for pennies in just a few weeks, when their IT department wanted 1 year and $900k to do the same thing. Needless to say, I looked like a giant stud in my managers eyes. Drupal 7 was a fantastic version, but the pain of migrating from major version to major version is still very much real.

    I have found that running dev, testing and prod version in my personal shared hosted service (I run the entire server on cPanel) has the most efficient process for me to develop, test and push to production. But a couple of years ago, I just got so fed up with composer issues that I just gave up and moved on to BackdropCMS, to the point I migrated three sites from D7 to Backdrop.

    But, recently I have found the need to for one module that is not in Backdrop, and this module could be a game changer in my current project. And this project could be very lucrative if I am able to get it done. The module is google_map_services and I even asked if the dev would be interested in porting the module to BackdropCMS but I never heard back from him/her.

    So, with DrupalCMS, I said to myself, "keep an open mind and maybe it's not to late to migrate to DrupalCMS and continue on"! So I read the installation notes, which was not too bad, but for a noob, may not be ideal.

  • πŸ‡΅πŸ‡ΉPortugal joaomachado

    Well, for cPanel, I was able to fix it with this:

    In order to fix this on cPanel, you must run the following command using your ssh access:

    **<cpanel-user-name> =** this is your user name you use to login to cpanel.

    **<cms.example.com> =** your domain root directory.

    /home/<cpanel-user-name>/<cms.example.com>/vendor/drush/drush/drush cset package_manager.settings executables.composer /opt/cpanel/composer/bin/composer

    Example command: /home/user543/cms.example.com/vendor/drush/drush/drush cset package_manager.settings executables.composer /opt/cpanel/composer/bin/composer

    I also posted this on the StackExchange link above.

Production build 0.71.5 2024