0

I started from scratch for a new site, using Composer for all of it. Drupal core is at 8.3.7, and Commerce is at 2.0-RC1 (because those were the levels of another site that I was having trouble with that I needed to correct). All is working well.

In another post over on Drupal.org someone advised me not to make updates of Commerce that jump more than one release. So I planned to go to RC2, then RC3, then the move to 8.4 and the full 2.0 version of Commerce.

Try as I might, I cannot get any type of Commerce upgrade to work (I'm still staying at Core 8.3.7 for the time being) - either to RC2, RC3 or 2.0. I've tried every possible permutation of update and require, specifying the product as simply drupal/commerce and drupal/commerce:2.0-rc2, leaving the rest of the command blank or using --with-dependencies or --update-with-dependencies, etc.

No matter what I do, it keeps telling me that drupal/commerce_price is locked at 2.0.0-rc1, or that there is nothing to do.

For example, when I run composer require "drupal/commerce:2.0-rc2" --update-with-dependencies, I get:

./composer.json has been updated
Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages.

Problem 1

  • drupal/commerce_price 2.0.0-rc1 requires drupal/commerce 2.0.0-rc1 -> satisfiable by drupal/commerce[2.0.0-rc1] but these conflict with your requirements or minimum-stability.
  • drupal/commerce_price 2.0.0-rc1 requires drupal/commerce 2.0.0-rc1 -> satisfiable by drupal/commerce[2.0.0-rc1] but these conflict with your requirements or minimum-stability.
  • drupal/commerce_price 2.0.0-rc1 requires drupal/commerce 2.0.0-rc1 -> satisfiable by drupal/commerce[2.0.0-rc1] but these conflict with your requirements or minimum-stability.
  • Installation request for drupal/commerce_price (locked at 2.0.0-rc1) -> satisfiable by drupal/commerce_price[2.0.0-rc1].

If I run composer update drupal/commerce --with-dependencies, I get:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
Drupal\Core\Composer\Composer::preAutoloadDump
Drupal\Core\Composer\Composer::ensureHtaccess

When I try composer require drupal/commerce --update-with-dependencies, I get:

Using version ^2.0 for drupal/commerce
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
Drupal\Core\Composer\Composer::preAutoloadDump
Drupal\Core\Composer\Composer::ensureHtaccess

These are the commerce-related entries returned from composer outdated.

drupal/commerce 2.0.0-rc1 2.0.0 > Drupal Commerce is a flexible eCommerce solution. drupal/commerce_order 2.0.0-rc1 2.0.0 > Defines the Order entity and associated features. drupal/commerce_payment 2.0.0-rc1 2.0.0 > Provides payment functionality. drupal/commerce_price 2.0.0-rc1 2.0.0 > Defines the Currency entity. drupal/commerce_store 2.0.0-rc1 2.0.0 > Defines the Store entity and associated features.

So there is work to be done. Why won't Composer allow me to make to upgrades?

To provide a little more information, this is the main part of the composer.json file.

"require": {
    "composer/installers": "^1.0.24",
    "wikimedia/composer-merge-plugin": "~1.4",
    "drush/drush": "^8.1",
    "drupal/ctools": "^3.0",
    "drupal/embed": "^1.0",
    "drupal/token": "^1.0",
    "drupal/addtoany": "^1.8",
    "drupal/admin_toolbar": "^1.20",
    "drupal/admin_toolbar_tools": "^1.20",
    "drupal/back_to_top": "1.x-dev",
    "drupal/contact_block": "^1.4",
    "drupal/contact_storage": "1.x-dev",
    "drupal/copyright_block": "1.x-dev",
    "drupal/ds": "^3.1",
    "drupal/entity_browser": "^1.3",
    "drupal/entity_embed": "1.x-dev",
    "drupal/honeypot": "^1.27",
    "drupal/social_media_links": "^2.5",
    "drupal/textarea_widget_for_text": "^1.0",
    "drupal/video_embed_field": "^1.5",
    "drupal/webform": "5.x-dev",
    "drupal/panelbutton": "^1.1",
    "drupal/colorbutton": "^1.1",
    "drupal/ckeditor_font": "^1.0",
    "drupal/google_analytics": "^2.2",
    "drupal/google_analytics_reports": "3.x-dev",
    "drupal/metatag": "^1.3",
    "drupal/pathauto": "^1.0",
    "drupal/redirect": "1.x-dev",
    "drupal/sitemap": "^1.3",
    "drupal/w3c_validator": "^1.3",
    "drupal/commerce": "^2.0",
    "drupal/search_api": "^1.5",
    "drupal/commerce_authnet": "1.x-dev",
    "drupal/commerce_paypal": "1.x-dev"
},
"replace": {
    "drupal/core": "~8.3"
}

Note that the entry for drupal/commerce has been added after I ran the commands listed above. I checked my archive and its value started out as "drupal/commerce": "2.0-rc1".

These are parts of the composer.lock file after I ran those commands.

        "name": "drupal/commerce_store",
        "version": "2.0.0-rc1",
        "require": {
            "drupal/commerce": "self.version",
            "drupal/commerce_price": "*",
            "drupal/core": "*"
        },
        "type": "metapackage",
        "extra": {
            "branch-alias": {
                "dev-2.x": "2.x-dev"
            },
            "drupal": {
                "version": "8.x-2.0-rc1",
                "datestamp": "1504208045",
                "security-coverage": {
                    "status": "not-covered",
                    "message": "RC releases are not covered by Drupal security advisories."
                }
            }
        },

       "name": "drupal/commerce",
        "version": "2.0.0-rc1",
        "source": {
            "type": "git",
            "url": "https://git.drupal.org/project/commerce",
            "reference": "8.x-2.0-rc1"
        },
        "dist": {
            "type": "zip",
            "url": "https://ftp.drupal.org/files/projects/commerce-8.x-2.0-rc1.zip",
            "reference": "8.x-2.0-rc1",
            "shasum": "e82857cd23c7eebe32a7fa14002d7ab2156dc0a6"
        },
        "require": {
            "commerceguys/intl": "~0.7",
            "drupal/address": "~1.0",
            "drupal/core": "~8.3",
            "drupal/entity": "~1.0",
            "drupal/entity_reference_revisions": "~1.0",
            "drupal/inline_entity_form": "~1.0",
            "drupal/profile": "~1.0",
            "drupal/state_machine": "~1.0",
            "ext-bcmath": "*"
        },
        "require-dev": {
            "drupal/commerce_cart": "*",
            "drupal/commerce_order": "*",
            "drupal/commerce_payment": "*",
            "drupal/commerce_price": "*",
            "drupal/commerce_product": "*",
            "drupal/commerce_store": "*",
            "drupal/entity_reference_revisions": "*",
            "drupal/inline_entity_form": "*",
            "drupal/profile": "*",
            "drupal/state_machine": "*"
        },
        "type": "drupal-module",
        "extra": {
            "branch-alias": {
                "dev-2.x": "2.x-dev"
            },
            "drupal": {
                "version": "8.x-2.0-rc1",
                "datestamp": "1504208045",
                "security-coverage": {
                    "status": "not-covered",
                    "message": "RC releases are not covered by Drupal security advisories."
                }
            }

        "name": "drupal/commerce_order",
        "version": "2.0.0-rc1",
        "require": {
            "drupal/commerce": "self.version",
            "drupal/commerce_price": "*",
            "drupal/commerce_store": "*",
            "drupal/core": "*",
            "drupal/entity_reference_revisions": "*",
            "drupal/profile": "*",
            "drupal/state_machine": "*"
        },
        "type": "metapackage",
        "extra": {
            "branch-alias": {
                "dev-2.x": "2.x-dev"
            },
            "drupal": {
                "version": "8.x-2.0-rc1",
                "datestamp": "1504208045",
                "security-coverage": {
                    "status": "not-covered",
                    "message": "RC releases are not covered by Drupal security advisories."

       "name": "drupal/commerce_price",
        "version": "2.0.0-rc1",
        "require": {
            "drupal/commerce": "self.version",
            "drupal/core": "~8.0"
        },
        "type": "metapackage",
        "extra": {
            "branch-alias": {
                "dev-2.x": "2.x-dev"
            },
            "drupal": {
                "version": "8.x-2.0-rc1",
                "datestamp": "1504208045",
                "security-coverage": {
                    "status": "not-covered",
                    "message": "RC releases are not covered by Drupal security advisories."
                }
            }

        "name": "drupal/commerce_store",
        "version": "2.0.0-rc1",
        "require": {
            "drupal/commerce": "self.version",
            "drupal/commerce_price": "*",
            "drupal/core": "*"
        },
        "type": "metapackage",
        "extra": {
            "branch-alias": {
                "dev-2.x": "2.x-dev"
            },
            "drupal": {
                "version": "8.x-2.0-rc1",
                "datestamp": "1504208045",
                "security-coverage": {
                    "status": "not-covered",
                    "message": "RC releases are not covered by Drupal security advisories."
                }
            }
7
  • Commerce 2.0 (official release) requires 8.4.0. If you're starting from scratch, I would start with the most recent version of core and commerce unless you have a specific reason not to. Oct 16, 2017 at 15:42
  • Patrick: I realize that (ie, 8.4). But I still don't understand why I cannot update to RC2 and RC3. Those should work under 8.3.7.
    – marrer
    Oct 16, 2017 at 15:48
  • Delete composer.lock, delete /vendor, and delete any other directories that are automatically created by composer. (Make a backup first if you don't have one.) Then run composer install from the empty repo state; this can sometimes fix dependency problems when there is a problem such as the one you describe. Oct 16, 2017 at 15:54
  • BTW, I am not actually at the scratch stage anymore. I cut and pasted all of the content over from the old site to the new site. I wish I could have simply copied over the database, but all of the tables were incorrectly named (due to my having started out on the old site with Softaculous).
    – marrer
    Oct 16, 2017 at 15:56
  • Patrick: re: "and delete any other directories that are automatically created by composer". You mean like modules/contrib, profiles/contrib, themes/contrib and drush/contrib? There are a boat-load of folders and files in there - several had the settings then customized after installation. So in other words - wipe everything out and start over? And what's to say that the exact same thing will not occur? If these are known dependency problems and issues, why haven't they been addressed and fixed?
    – marrer
    Oct 16, 2017 at 16:06

2 Answers 2

0

I tried what Patrick Kenney suggested in the comments:

Delete composer.lock
delete /vendor
composer install

and it didn't work. It was still complaining about commerce_price being locked at the RC1 version.

So I reloaded my backup and tried it again, only this time I made sure the line for drupal/commerce was also removed from the composer,json file. Then I did a composer require drupal/commerce. All seems OK now - fingers crossed.

In addition, I seem to recall reading this elsewhere, but to make sure the install of Drupal core for 8.4 worked correctly, I also had to move the drupal/core entry in composer.json from the replace to the require section.

Thanks for the help, Patrick!

0

There are indeed some issues with updating Commerce with Composer. These are related to how packages.drupal.org is implemented. The reason of this issue is that contributed Commerce modules depend on a 'submodule' of Commerce. Commerce Shipping for example depends on Commerce Order and on Commerce Price.

Solution from https://www.drupal.org/node/2906495#comment-12254258:

  1. Run composer why drupal/commerce to see which packages depend on Drupal Commerce, for example:

    drupal/commerce_order    2.0.0-rc1               requires  drupal/commerce (self.version)  
    drupal/commerce_payment  2.0.0-rc1               requires  drupal/commerce (self.version)  
    drupal/commerce_price    2.0.0-rc1               requires  drupal/commerce (self.version)  
    drupal/commerce_store    2.0.0-rc1               requires  drupal/commerce (self.version)  
    .....
    
  2. Run composer update and include every composer package that says 'self.version', for example:

    composer update drupal/commerce drupal/commerce_order drupal/commerce_payment drupal/commerce_price drupal/commerce_store
    

This gets around composer insisting that you need exactly the version that is installed for the subcomponents, despite the fact that they should all be satisfied with whatever version is already installed.

Alternative solution: composer update

An alternative solution is to run just composer update. Composer will then update all packages, including Symfony components. There is a little risk in doing this: the latest versions of Symfony components are not guaranteed to be compatible with the latest Drupal version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.