drupal-composer/drupal-project

My site is bricked

mikikuke opened this issue · 2 comments

Like you mentioned I replaced the composer.json file and just added code for my modules

I ran composer update

ddev composer update drupal/core "drupal/core-*" --with-all-dependencies

now I get this error when I visit my site

Fatal error: Uncaught TypeError: Argument 1 passed to Dotenv\Dotenv::__construct() must be an instance of Dotenv\Loader\LoaderInterface, string given, called in /var/www/html/load.environment.php on line 14 and defined in /var/www/html/vendor/vlucas/phpdotenv/src/Dotenv.php:47 Stack trace: #0 /var/www/html/load.environment.php(14): Dotenv\Dotenv->__construct('/var/www/html') #1 /var/www/html/vendor/composer/autoload_real.php(73): require('/var/www/html/l...') #2 /var/www/html/vendor/composer/autoload_real.php(63): composerRequiree9fd76ec684d1f4ff4670bc0f2b13c37('d511210698f02d8...', '/var/www/html/v...') #3 /var/www/html/vendor/autoload.php(7): ComposerAutoloaderInite9fd76ec684d1f4ff4670bc0f2b13c37::getLoader() #4 /var/www/html/web/autoload.php(17): require('/var/www/html/v...') #5 /var/www/html/web/index.php(14): require_once('/var/www/html/w...') #6 {main} thrown in /var/www/html/vendor/vlucas/phpdotenv/src/Dotenv.php on line 47

Then I tried this update command

ddev composer require drupal/core-recommended:^8.8 drupal/core:^8.8 drupal/core-composer-scaffold:^8.8 --update-with-dependencies

and got this errror inside CLI

rning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2 is now available and you should upgrade. See https://getcomposer.org/2
./composer.json has been updated
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Warning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2 is now available and you should upgrade. See https://getcomposer.org/2
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - masterminds/html5 2.3.0 conflicts with symfony/dom-crawler[v4.4.24].
    - masterminds/html5 2.3.0 conflicts with symfony/dom-crawler[v4.4.24].
    - masterminds/html5 2.3.0 conflicts with symfony/dom-crawler[v4.4.24].
    - drupal/core-recommended 8.8.0 requires masterminds/html5 2.3.0 -> satisfiable by masterminds/html5[2.3.0].
    - Installation request for drupal/core-recommended 8.8 -> satisfiable by drupal/core-recommended[8.8.0].
    - Installation request for symfony/dom-crawler (locked at v4.4.24) -> satisfiable by symfony/dom-crawler[v4.4.24].


Installation failed, reverting ./composer.json to its original content.
composer [require drupal/core-recommended:8.8 drupal/core:8.8 drupal/core-composer-scaffold:8.8 --update-with-dependencies] failed, composer command failed: exit status 2. stderr=

PLEASE HELP

{
    "name": "drupal-composer/drupal-project",
    "description": "Project template for Drupal 8 projects with composer",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "authors": [
        {
            "name": "",
            "role": ""
        }
    ],
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require": {
        "php": ">=7.0.8",
        "composer/installers": "^1.2",
        "cweagans/composer-patches": "^1.6.5",
        "drupal/adaptivetheme": "^3.1",
        "drupal/address": "^1.6",
        "drupal/addtoany": "^1.12",
        "drupal/admin_toolbar": "^3.0",
        "drupal/advagg": "^3.5",
        "drupal/at_tools": "^3.2",
        "drupal/backup_migrate": "^4.0",
        "drupal/checklistapi": "^2.0",
        "drupal/ckeditor_youtube": "^1.1",
        "drupal/commerce": "^2.13",
        "drupal/console": "^1.0.2",
        "drupal/core": "^8.8.0",
        "drupal/core-composer-scaffold": "^8.8.0",
        "drupal/imce": "^1.7",
        "drupal/inline_entity_form": "^1.0@RC",
        "drupal/linkit": "5.0.*@dev",
        "drupal/ludwig": "^1.0",
        "drupal/metatag": "^1.8",
        "drupal/pathauto": "^1.4",
        "drupal/profile": "^1.0@RC",
        "drupal/redirect": "^1.3",
        "drupal/seo_checklist": "^5.0",
        "drupal/simple_sitemap": "^3.1",
        "drupal/sitemap": "^1.5",
        "drupal/state_machine": "^1.0@RC",
        "drupal/stringoverrides": "1.x-dev",
        "drupal/token": "^1.5",
        "drupal/upgrade_status": "3.0",
        "drupal/views_bulk_operations": "^3.13",
        "drupal/views_slideshow": "^4.6",
        "drupal/webform": "5.26",
        "drush/drush": "^9.7.1 | ^10.0.0",
        "vlucas/phpdotenv": "^4.0",
        "webflo/drupal-finder": "^1.0.0",
        "zaporylie/composer-drupal-optimizations": "^1.0"
    },
    "require-dev": {
        "drupal/core-dev": "^8.8.0"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "sort-packages": true
    },
    "autoload": {
        "classmap": [
            "scripts/composer/ScriptHandler.php"
        ],
        "files": ["load.environment.php"]
    },
    "scripts": {
        "pre-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "pre-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "post-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ],
        "post-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ]
    },
    "extra": {
        "composer-exit-on-patch-failure": true,
        "patchLevel": {
            "drupal/core": "-p2"
        },
        "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"]
        }
    }
}

Revert your composer.json, downgrade to Composer 1 again, run composer install, fine. Now start to manually adjust your composer.json step by step. After every updated section, run composer install again to verify all is working fine. Also remember to update other files this project template provides (load.environment.php, ScripHandler.php etc.). When you are done, and composer install works just fine, switch to Composer 2 again, run composer install once again and now try to update the packages that will be mentioned in the error output to not be compatible with Composer 2. Please get help on Drupal Slack which is the place for back and forth clarifications on general Composer/Drupal problems. Thank you