Question

running composer install with the Drupal 8 recommended setup fails when installing coder with authentication message or similar. Does somebody else have this behavior?

Workaround was to run composer install --no-dev and running composer install afterwards, but this doesn't install Coder. Colleagues told me they have similar problems with different libraries.

Here is my composer.json

{
    "name": "drupal/recommended-project",
    "description": "Project template for Drupal 8 projects with a relocated document root",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "homepage": "https://www.drupal.org/project/drupal",
    "support": {
        "docs": "https://www.drupal.org/docs/user_guide/en/index.html",
        "chat": "https://www.drupal.org/node/314178"
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require": {
        "composer/installers": "^1.2",
        "drupal/core-composer-scaffold": "^8.8",
        "drupal/core-project-message": "^8.8",
        "drupal/core-recommended": "^8.8"
    },
    "require-dev": {
        "drupal/core-dev": "^8.8"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "sort-packages": true
    },
    "extra": {
        "drupal-scaffold": {
            "locations": {
                "web-root": "web/"
            }
        },
        "installer-paths": {
            "web/core": ["type:drupal-core"],
            "web/libraries/{$name}": ["type:drupal-library"],
            "web/modules/contrib/{$name}": ["type:drupal-module"],
            "web/profiles/contrib/{$name}": ["type:drupal-profile"],
            "web/themes/contrib/{$name}": ["type:drupal-theme"],
            "drush/Commands/contrib/{$name}": ["type:drupal-drush"],
            "web/modules/custom/{$name}": ["type:drupal-custom-module"],
            "web/themes/custom/{$name}": ["type:drupal-custom-theme"]
        },
        "drupal-core-project-message": {
            "include-keys": ["homepage", "support"],
            "post-create-project-cmd-message": [
                "<bg=blue;fg=white>                                                         </>",
                "<bg=blue;fg=white>  Congratulations, you’ve installed the Drupal codebase  </>",
                "<bg=blue;fg=white>  from the drupal/recommended-project template!          </>",
                "<bg=blue;fg=white>                                                         </>",
                "",
                "<bg=yellow;fg=black>Next steps</>:",

                "  * Install the site: https://www.drupal.org/docs/8/install",
                "  * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
                "  * Get support: https://www.drupal.org/support",
                "  * Get involved with the Drupal community:",
                "      https://www.drupal.org/getting-involved",
                "  * Remove the plugin that prints this message:",
                "      composer remove drupal/core-project-message"
            ]
        }
    }
}

Here the Error-Message while running composer install inside the container

:/var/www/html/web$ composer install
No composer.json in current directory, do you want to use the one at /var/www/html? [Y,n]? y
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 9 installs, 0 updates, 0 removals
  - Installing drupal/coder (8.3.6): Cloning 4337ddf58d from cache
    4337ddf58d28dbdee4e1367bf71ee13393ab9820 is gone (history was rewritten?)


  [RuntimeException]                                                                                                                              
  Failed to execute git checkout '4337ddf58d28dbdee4e1367bf71ee13393ab9820' -- && git reset --hard '4337ddf58d28dbdee4e1367bf71ee13393ab9820' --  

  fatal: failed to read object 4337ddf58d28dbdee4e1367bf71ee13393ab9820: Operation not permitted                                                  


install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--i
gnore-platform-reqs] [--] [<packages>]...

And here when running composer install locally inside the source dir:

λ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 9 installs, 0 updates, 0 removals
  - Installing drupal/coder (8.3.6):     Authentication required (git.drupalcode.org):
      Username:

I started by installing D8 like described here https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies This initially worked and we commited the codebase (mostly composer.json & composer.lock) into our git-lab, but after checkout to a different folder and runing composer install with the composer.json & composer.lock fails as described above.

Was it helpful?

Solution

I am not sure yet why, but running composer install --no-cache fixes that issue for me. Maybe someone could shine some more light on whats going on there.

uid1000@drupal-web:/var/www/html/web$ composer install --no-cache
No composer.json in current directory, do you want to use the one at /var/www/html? [Y,n]? y
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 9 installs, 0 updates, 0 removals
  - Installing drupal/coder (8.3.6): Cloning 4337ddf58d
  - Installing seld/phar-utils (1.0.1): Downloading (100%)
  - Installing seld/jsonlint (1.7.1): Downloading (100%)
  - Installing composer/composer (1.9.1): Downloading (100%)
Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top