The issue

Not sure whether this is a bug in Composer Manager or drupal-composer/drupal-project; and for now I can't see where to raise issues on Packagist / drupal-composer/drupal-project. So I'll start here. It would be really great to use Composer for Drupal as we do pip and npm as we do for Python and Node.js. What still remains to sort out?

  1. Composer Manager cannot find autoloader.php in the current working directory (Command.php on line 52) as drupal-composer/drupal-project has installed it in the immediate subdirectory; namely [project root]/web/autoloader.php
  2. The vendor directory is installed in the directory above the Drupal doc root. I read in another Composer Manager issue that Composer Manager now assumes that vendor "is in Drupal root now - moved from core/vendor. If so, drupal-composer/drupal-project is making different assumptions.
  3. PackageManager and ExtensionDiscovery are looking in the wrong root also.

The steps

composer create-project drupal-composer/drupal-project:8.x-dev Dev_BA --stability dev --no-interaction

cd Dev_BA

composer require drupal/composer_manager:8.x-1.x-dev

php web/modules/contrib/composer_manager/scripts/init.php
#=> Composer Manager has been successfully initialized.

composer drupal-rebuild
#=> Fatal error: Drupal\composer_manager\Composer\Command::getPackageManager(): Failed opening required '.../Dev_BA/autoload.php' (include_path='.:') in .../Dev_BA/web/modules/contrib/composer_manager/src/Composer/Command.php on line 52

Comments

iainH created an issue. See original summary.

iainh’s picture

Issue summary: View changes
bojanz’s picture

Composer Manager are drupal-composer/drupal-project mutually exclusive. Use one or another.

drupal-composer/drupal-project is the recommended way of using Composer.
Add modules to your composer.json and you're good to go

iainh’s picture

Status: Active » Closed (works as designed)

Excellent!

BTW is there some way of drupal-composer/drupal-project saying something like:

 "conflict": {
        "drupal/composer_manager": "*"
    }

I edited the "Composer in relation to Drush Make" page to state that the functionality of Composer Manager and drupal-composer/drupal-project are mutually exclusive. That was where I - and I guess others - first came across drupal-composer/drupal-project.

bojanz’s picture

That's a great idea, though it would only warn people trying to download composer_manager through Composer.

iainh’s picture

People like me! !:-)

It mightn't warn everybody but I still think it would serve a useful purpose.

If their starting point was the "Composer in relation to Drush Make" page, chances are they're going to want to continue with composer. Then they're going to come across advice for installing swiftmailer or the like and they're going to be told '"you need to install composer_manager". They'd appreciate an automated warning, I think.

bojanz’s picture

Title: Autoloader Incompatibilities with drupal-composer/drupal-project » Mark as incompatible with drupal-composer/drupal-project
Status: Closed (works as designed) » Active

Yeah, let's do something.

bojanz’s picture

Category: Bug report » Support request
Status: Active » Fixed

I'm about to deprecate Composer Manager, tell people to use Composer directly (with or without drupal-composer/drupal-project).

I guess that counts as "something". :)

bojanz’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.