Score:0

Getting existing composer managed site to legacy-project composer managed

de flag

[Update] I seem to be making some actual progress by just replacing the the composer.json with https://github.com/drupal/legacy-project/blob/8.9.x/composer.json and then doing a composer require [all the projects]

I'm trying to clean up an older site that wasn't well cared for with regards to managing composer dependencies. I have deleted the core and vendor directories, and composer.lock and am now trying to use the legacy-composer template to install. However, I'm getting the following error:

Problem 1 - drupal/legacy-project is present at version dev-master and cannot be modified by Composer - drupal/lightning_media 4.9.0 requires drupal/core ^8.9 || ^9.0.1 || ^10 -> satisfiable by drupal/core[8.9.20]. - Only one of these can be installed: drupal/core[8.9.20], drupal/legacy-project[dev-master]. They both replace drupal/action and thus cannot coexist. - drupal/lightning_media is locked to version 4.9.0 and an update of this package was not requested.

This line is definitely confusing me as it seems it's installing 2 versions of Drupal

Only one of these can be installed: drupal/core[8.9.20], drupal/legacy-project[dev-master]. They both replace drupal/action and thus cannot coexist

I'm not certain that line is even problematic though. My end goal is to get to Drupal 9.x and eventually 10.

The existing composer.json file used this (truncated):

{
    "name": "drupal/drupal",
    "description": "Drupal is an open source content management platform powering millions of websites and applications.",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "require": {
        ...
    },
    "replace": {
        "drupal/core": "^8"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
}

My current iteration, in its entirety, composer.json file:

{
    "name": "drupal/legacy-project",
    "description": "Drupal is an open source content management platform powering millions of websites and applications.",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "require": {
        "drupal/console": "~1.0",
        "wikimedia/composer-merge-plugin": "^2",
        "cweagans/composer-patches": "^1.6",
        "drupal/lightning_media": "*",
        "drupal/lightning_api": "*",
        "drupal/webform": "*",
        "drupal/admin_toolbar": "*",
        "drupal/taxonomy_menu": "*",
        "drupal/search_api": "*",
        "drupal/select2": "*",
        "drupal/slick": "*",
        "drupal/paragraphs": "*",
        "drupal/slick_entityreference": "*",
        "drupal/entity_reference_display": "*",
        "drupal/slick_views": "*",
        "drupal/restui": "*",
        "drupal/taxonomy_manager": "*",
        "drupal/jsonapi_extras": "*",
        "drupal/fontawesome": "*",
        "drupal/slick_extras": "*",
        "drupal/facets": "*",
        "drupal/entity_embed": "*",
        "drupal/pathauto": "*",
        "drupal/twig_tweak": "*",
        "drupal/openid_connect": "*",
        "drupal/facets_pretty_paths": "*",
        "drupal/simple_oauth": "*",
        "drupal/inline_entity_form": "*",
        "drupal/entity_browser": "*",
        "drupal/facebook_pixel": "*",
        "drupal/xmlsitemap": "*",
        "drupal/simple_sitemap": "*",
        "drupal/pantheon_advanced_page_cache": "*",
        "drupal/address": "*",
        "drupal/metatag": "*",
        "drupal/field_group": "*",
        "drupal/moderation_dashboard": "*",
        "drupal/ctools": "*",
        "drupal/ctools_block": "*",
        "drupal/layout_builder_st": "*",
        "drupal/migrate_plus": "*",
        "drupal/migrate_tools": "*",
        "drupal/custom_sql_migrate_source_plugin": "*",
        "drupal/layout_library": "*",
        "drupal/migrate_file": "*",
        "drupal/remote_stream_wrapper": "*",
        "drupal/field_tools": "*",
        "drupal/search_api_pantheon": "*",
        "drupal/kint": "*",
        "drupal/ds": "*",
        "drupal/field_group_easy_responsive_tabs": "*",
        "drupal/focal_point": "*",
        "drupal/crop": "*",
        "drupal/video_embed_field": "*",
        "drupal/bootstrap_barrio": "*",
        "drupal/bootstrap_sass": "*",
        "drupal/color_field": "*",
        "drupal/sendgrid_integration": "*",
        "drupal/addtoany": "*",
        "drupal/allowed_formats": "*",
        "drupal/search_api_solr": "*",
        "drupal/search_api_autocomplete": "*",
        "drupal/honeypot": "*",
        "drupal/recaptcha": "*",
        "mikehaertl/phpwkhtmltopdf": "^2.5",
        "drupal/swiftmailer": "*",
        "drupal/viewsreference": "*",
        "drupal/entity_print": "*",
        "drupal/colorbutton": "*",
        "drupal/panelbutton": "*",
        "drupal/fullcalendar_view": "*",
        "drupal/entity_hierarchy": "*",
        "drupal/better_exposed_filters": "*",
        "drupal/fvm": "*",
        "drupal/block_field": "*",
        "drupal/views_infinite_scroll": "*",
        "drupal/redis": "*",
        "drupal/google_analytics": "*",
        "drupal/views_bulk_edit": "*",
        "drupal/upgrade_status": "*",
        "drupal/bricks": "*",
        "drupal/credit_due": "*",
        "drupal/constant_contact_block": "*",
        "drupal/twig_field_value": "*",
        "drupal/views_bulk_operations": "*",
        "drupal/simple_popup_blocks": "*",
        "drupal/libraries": "*",
        "composer/installers": "^1.2",
        "drupal/core-composer-scaffold": "^8.8",
        "drupal/core-project-message": "^8.8",
        "drupal/core-recommended": "^8.8",
        "drupal/core-vendor-hardening": "^8.8",
        "drupal/page_manager": "*",
        "drupal/page_manager_ui":  "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "process-timeout": 0,
        "preferred-install": "dist",
        "autoloader-suffix": "Drupal8",
        "allow-plugins": {
            "composer/installers": true,
            "drupal/console-extend-plugin": true,
            "oomphinc/composer-installers-extender": true,
            "drupal/core-vendor-hardening": true,
            "wikimedia/composer-merge-plugin": true,
            "cweagans/composer-patches": true,
            "dealerdirect/phpcodesniffer-composer-installer": true,
            "drupal/core-composer-scaffold": true,
            "drupal/core-project-message": true
        }
    },
    "conflict": {
        "doctrine/common": ">2.8"
    },
    "extra": {
        "enable-patching": true,
        "patches": {
            "drupal/drupal": "https://www.drupal.org/files/issues/2018-07-16/2985882-entityfield-2.patch",
            "drupal/field_color": "https://www.drupal.org/files/issues/2020-09-16/the-default-value-not-show-when-select-color-boxes-3171205-2.patch",
            "field_tools": "https://www.drupal.org/files/issues/2020-08-04/3160564-wrong-parameters-for-service-classes.patch",
            "fullcalendar": "sites/default/patchrwt_resource.installes/full-calendar-mods.patch"
        },
        "_readme": [
            "By default Drupal loads the autoloader from ./vendor/autoload.php.",
            "To change the autoloader you can edit ./autoload.php.",
            "This file specifies the packages.drupal.org repository.",
            "You can read more about this composer repository at:",
            "https://www.drupal.org/node/2718229"
        ],
        "merge-plugin": {
            "include": [
                "core/composer.json"
            ],
            "recurse": true,
            "replace": false,
            "merge-extra": false
        },
        "installer-paths": {
            "core": ["type:drupal-core"],
            "modules/contrib/{$name}": ["type:drupal-module"],
            "profiles/contrib/{$name}": ["type:drupal-profile"],
            "themes/contrib/{$name}": ["type:drupal-theme"],
            "drush/contrib/{$name}": ["type:drupal-drush"],
            "modules/custom/{$name}": ["type:drupal-custom-module"],
            "themes/custom/{$name}": ["type:drupal-custom-theme"]
        }
    },
    "autoload": {
        "psr-4": {
            "Drupal\\Core\\Composer\\": "core/lib/Drupal/Core/Composer"
        }
    },
    "scripts": {
        "pre-autoload-dump": "Drupal\\Core\\Composer\\Composer::preAutoloadDump",
        "post-autoload-dump": "Drupal\\Core\\Composer\\Composer::ensureHtaccess",
        "drupal-phpunit-upgrade-check": "Drupal\\Core\\Composer\\Composer::upgradePHPUnit",
        "drupal-phpunit-upgrade": "@composer update phpunit/phpunit phpspec/prophecy symfony/yaml --with-dependencies --no-progress",
        "phpcs": "phpcs --standard=core/phpcs.xml.dist --runtime-set installed_paths $($COMPOSER_BINARY config vendor-dir)/drupal/coder/coder_sniffer --",
        "phpcbf": "phpcbf --standard=core/phpcs.xml.dist --runtime-set installed_paths $($COMPOSER_BINARY config vendor-dir)/drupal/coder/coder_sniffer --"
    },
    "repositories": [{
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        {
            "type": "composer",
            "url": "https://asset-packagist.org"
        },
        {
            "type": "package",
            "package": {
                "name": "fullcalendar/fullcalendar",
                "version": "4.4.0",
                "type": "drupal-library",
                "dist": {
                    "url": "https://github.com/fullcalendar/fullcalendar/releases/download/v4.4.0/fullcalendar-4.4.0.zip",
                    "type": "zip"
                }
            }
        }
    ],
    "require-dev": {
        "drush/drush": "^9.7",
        "drupal/core-dev": "^8.9"
    }
}

After deleting the core, vendor, and composer.lock files I run composer update which does a lot before ending with this error. The final output before the error is:

Generating autoload files Drupal\Core\Composer\Composer::preAutoloadDump Hardening vendor directory with .htaccess and web.config files. Drupal\Core\Composer\Composer::ensureHtaccess 79 packages you are using are looking for funding. Use the composer fund command to find out more!

Running composer update to apply merge settings Gathering patches for root package. Loading composer repositories with package information Info from https://repo.packagist.org: #StandWithUkraine Updating dependencies

What do I need to do to get this to a good point with composer at Drupal 8, so that I can then upgrade to 9?

4uk4 avatar
cn flag
If you did run update.php on the latest Drupal 8 version you don't need to replicate the Drupal 8 composer project, you can go directly to a Drupal 9 codebase (which you can build with any method you prefer) and then update the database.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.