drupal-composer/drupal-project

Getting "Webmozart\PathUtil\Path" not found creating a Drupal 10 project

EugenMayer opened this issue · 6 comments

Drupal 10 is going to be released next month, so it might be worth preparing for that.

Using

composer create-project drupal-composer/drupal-project:10.x-dev /var/www --no-interaction --ignore-platform-reqs

Will currently fail with

> mglaman/phpstan-drupal: installed
PHP CodeSniffer Config installed_paths set to ../../drupal/coder/coder_sniffer,../../sirbrillig/phpcs-variable-analysis,../../slevomat/coding-standard
> DrupalProject\composer\ScriptHandler::createRequiredFiles

In ScriptHandler.php line 46:
                                             
  [Error]                                    
  Class "Webmozart\PathUtil\Path" not found

Just wanted to know if there are plans at all or a specific schedule? Thank you for all the work.

Are there any plans?

Yes, there's a 10.x branch, right? Means, this template is looking ahead to a Drupal 10 release.

Is there a specific schedule?

No. This is a community project. You find a bug, you fix it and provide an MR.


Maybe provide a bit more context to the error you got. Like OS, PHP version, Composer version.

i hope you ways to communicate give you some stress relieve at least, because on the other side, it's not entirely helpful.
I'am new to github so i'am glad you told me the basic rules.

Env

Sorry i forget the env, should have added it:

  • php 8.1
    php --version
    PHP 8.1.12 (cli) (built: Oct 28 2022 18:32:13) (NTS)
  • composer 2.4.4 (latest stable)
    composer --version
    Composer version 2.4.4 2022-10-27 14:39:29
  • debian bullseye
    lsb_release  -a
    No LSB modules are available.
    Distributor ID: Debian
    Description:    Debian GNU/Linux 11 (bullseye)
    Release:        11
    Codename:       bullseye

It is an isolated docker based ci build, so there should be no pollution.

Maybe more context in the logs might help

Logs

phpstan/extension-installer: Extensions installed
> composer/composer: installed
> mglaman/phpstan-drupal: installed
PHP CodeSniffer Config installed_paths set to ../../drupal/coder/coder_sniffer,../../sirbrillig/phpcs-variable-analysis,../../slevomat/coding-standard
> DrupalProject\composer\ScriptHandler::createRequiredFiles

In ScriptHandler.php line 46:
                                             
  [Error]                                    
  Class "Webmozart\PathUtil\Path" not found  
                                             

Exception trace:
  at /var/www/scripts/composer/ScriptHandler.php:46
 DrupalProject\composer\ScriptHandler::createRequiredFiles() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:386
 Composer\EventDispatcher\EventDispatcher->executeEventPhpScript() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:246
 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:123
 Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///usr/local/bin/composer/src/Composer/Installer.php:374
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/CreateProjectCommand.php:263
 Composer\Command\CreateProjectCommand->installProject() at phar:///usr/local/bin/composer/src/Composer/Command/CreateProjectCommand.php:171
 Composer\Command\CreateProjectCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:1028
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:299
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:375
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:139
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:88
 require() at /usr/local/bin/composer:29

create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--add-repository] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--no-audit] [--audit-format AUDIT-FORMAT] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--ask] [--] [<package> [<directory> [<version>]]]

The command '/bin/sh -c composer create-project drupal-composer/drupal-project:10.x-dev /var/www --no-interaction --ignore-platform-reqs' returned a non-zero code: 1
##[error]Bash exited with code '1'.

Seems like there is an dependency on https://github.com/webmozart/path-util which is neither explicit not transitive.

We might be running into an issue with https://github.com/drupal-composer/drupal-scaffold depreaction and should probably migrate to https://github.com/drupal/core-composer-scaffold with the new 10.x build?

Reproducer

docker run -it php:8.1-bullseye bash
apt update && apt install -y git curl unzip
curl https://getcomposer.org/installer -o /tmp/composerinstaller
php /tmp/composerinstaller --install-dir=/usr/local/bin --filename=composer
composer create-project drupal-composer/drupal-project:10.x-dev  --no-interaction /tmp/www

webmozart/path-util was a dependency of drush in until version 11.2.1. 11.3 replaced it with symfony/filesystem. This bug applies to 9.x. It just works because 9.x uses on older version of consolidation/* dependencies.

There is the composer output.

→ composer why webmozart/path-util -t

webmozart/path-util 2.3.0 A robust cross-platform utility for normalizing, comparing and modifying file paths.
└──consolidation/site-alias 3.1.7 (requires webmozart/path-util ^2.3)
   ├──consolidation/site-process 4.2.1 (requires consolidation/site-alias ^3 || ^4)
   │  └──drush/drush 11.3.2 (requires consolidation/site-process ^4.1.3 || ^5)
   │     ├──drupal-composer/drupal-project 9.x-dev (requires drush/drush ^11.0)
   │     └──drupal/core 9.4.8 (conflicts drush/drush <8.1.10) (circular dependency aborted here)
   └──drush/drush 11.3.2 (requires consolidation/site-alias ^3.1.6 || ^4)
      ├──drupal-composer/drupal-project 9.x-dev (requires drush/drush ^11.0)
      └──drupal/core 9.4.8 (conflicts drush/drush <8.1.10) (circular dependency aborted here)

Means we could add "webmozart/path-util": "^2.3" to composer.json require section and it would work (without needing to refactor the ScriptHandler), right? @EugenMayer since you are new would you like to create that MR?

@leymannx not interested.

Thanks!