Roots Discourse

Deploy problem - non-zero return code(...) You are using Composer 2

I have a problem with deploy. I had a composer 2.0^ on vagrant but I made a downgrade to 1.6.0.

non-zero return code
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Warning: The lock file is not up to date with the latest changes in
composer.json. You may be getting outdated dependencies. It is recommended
that you run `composer update` or `composer update <package name>`.
Your lock file does not contain a compatible set of packages. Please run
composer update.

  Problem 1
    - composer/installers is locked to version v1.6.0 and an update of this
package was not requested.
    - composer/installers v1.6.0 requires composer-plugin-api ^1.0 -> found
composer-plugin-api[2.0.0] but it does not match the constraint.
  Problem 2
    - composer/installers v1.6.0 requires composer-plugin-api ^1.0 -> found
composer-plugin-api[2.0.0] but it does not match the constraint.
    - soberwp/controller 2.1.1 requires composer/installers ^1.0 ->
satisfiable by composer/installers[v1.6.0].
    - soberwp/controller is locked to version 2.1.1 and an update of this
package was not requested.

You are using Composer 2, which some of your plugins seem to be incompatible
with. Make sure you update your plugins or report a plugin-issue to ask them
to support Composer 2. (...)

After update and change .main.yml

composer_keep_updated: false
composer_version: '1.6.0'
composer_global_packages:
 - { name: hirak/prestissimo }

server.yml and dev.yml to:

{ role: composer, tags: [composer], composer_version: '1.6.0', composer_keep_updated: false }

I push changes to repo and make a provision

ansible-playbook server.yml -e env=production

But still I got an above error.
I can’t update composer to 2.0.0 because composer-plugin-api is not compatible.

How to resolve it ?

When you want to stay with composer 1, you have to take into account that the composer lock file has been updated to dependencies that only work with composer 2. The easiest way would be just removing the composer lock file and installing again using composer 1 - I know, I know, a lockfile has a purpose, but usually it should just work this way, test the site afterwards.

If you want to use the new composer 2, you have to update your Bedrock site, as recent Bedrock uses composer dependencies that are compatible with composer 2. Create a new Bedrock project and then overwrite your existing project with these files, then resolve conflicts/merge the changes. Usually it is the composer.json that you have to merge as it contains your plugins and some meta data.

1 Like

Thanks, I’ve updated composer to 2.0 and bedrock. That was a lot of changes in my environment. Downgrade python, update ansible, composer, bedrock + mismatch SSH keys… Crazy day