composer install or update error, what is wrong
Asked Answered
D

5

6

I have a problem. After command

composer update

I get error message

 [Symfony\Component\Console\Exception\LogicException]
  An option named "connection" already exists.


Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception


  [RuntimeException]
  An error occurred when executing the ""cache:clear --no-warmup"" command:





    [Symfony\Component\Console\Exception\LogicException]
    An option named "connection" already exists.

what am I doing wrong?

Exception trace:
 () at C:\wamp64\www\ecommerce\vendor\symfony\symfony\src\Symfony\Component\Console\Input\InputDefinition.php:232
 Symfony\Component\Console\Input\InputDefinition->addOption() at C:\wamp64\www\ecommerce\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php:384
 Symfony\Component\Console\Command\Command->addOption() at C:\wamp64\www\ecommerce\vendor\doctrine\doctrine-bundle\Command\Proxy\RunSqlDoctrineCommand.php:24
 Doctrine\Bundle\DoctrineBundle\Command\Proxy\RunSqlDoctrineCommand->configure() at C:\wamp64\www\ecommerce\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php:61
 Symfony\Component\Console\Command\Command->__construct() at C:\wamp64\www\ecommerce\vendor\doctrine\dbal\lib\Doctrine\DBAL\Tools\Console\Command\RunSqlCommand.php:36
 Doctrine\DBAL\Tools\Console\Command\RunSqlCommand->__construct() at C:\wamp64\www\ecommerce\var\cache\dev\appDevDebugProjectContainer.php:11355
 appDevDebugProjectContainer->getDoctrine_QuerySqlCommandService() at C:\wamp64\www\ecommerce\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\Container.php:329
 Symfony\Component\DependencyInjection\Container->get() at C:\wamp64\www\ecommerce\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:140
 Symfony\Bundle\FrameworkBundle\Console\Application->registerCommands() at C:\wamp64\www\ecommerce\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:100
 Symfony\Bundle\FrameworkBundle\Console\Application->all() at C:\wamp64\www\ecommerce\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:64
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at C:\wamp64\www\ecommerce\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:122
 Symfony\Component\Console\Application->run() at C:\wamp64\www\ecommerce\bin\console:27

I get all project with git, and on one computer all running, on second not running.

Dacoity answered 15/3, 2021 at 19:47 Comment(1)
your composer.json has a post-update-cmd that executes app/console cache:clear --no-warmup. Of which appears to be complaining that one of the Symfony Command configurations has conflicting connection options, potentially due to a stale cache. You may need to manually delete your app/cache/<env> directory before running composer update.Hemi
U
4

Run the command with the -vvv flag. It will show you which command is broken. For example:

bin/console -vvv

I have the same error after upgrade doctrine/dbal package. In my case RunSqlDoctrineCommand (from doctrine/doctrine-bundle package) conflicted with parent RunSqlCommand (from doctrine/dbal package). I've updated doctrine/doctrine-bundle:1.12.*, it contains fix for this case. This solved such problem.

Ultramarine answered 29/7, 2021 at 11:58 Comment(0)
N
4

On PHP 7.1, I had to:

  1. Update symfony/symfony from 3.3.* to 3.4.*
  2. Update doctrine/doctrine-bundle from ^1.6 to ^1.12
Nathalienathan answered 19/1, 2022 at 11:9 Comment(0)
K
3

Haven't dived too deep, but looks like doctrine/doctrine-bundle should have one of this versions: 2.4.3 2.4.2 2.4.1 2.4.0 2.3.2 2.3.1 2.3.0 2.2.4 2.2.3 2.2.2 2.2.1 2.2.0 2.1.2 2.1.1 2.1.0 2.0.10 2.0.9 1.12.13 1.12.12 1.12.11 1.12.10 1.12.9

So, update it to one of them.

For example, for 1.12 you can specify it like this at composer.json:

        "doctrine/doctrine-bundle": "^1.12.9",

And then composer update or composer update doctrine/doctrine-bundle

More details:

Kyrstin answered 1/11, 2021 at 13:11 Comment(0)
K
2

In my case, a certain project with symfony v3.3 failed doing composer install under PHP 7.4 and also PHP 7.2 saying An option named "connection" already exists..

Tested solutions:

  • Downgrading to PHP 7.0, it worked perfectly with SF v3.3
  • Upgrading symfony to v3.4, it worked perfectly with PHP 7.2 and 7.4.
Kampmann answered 20/6, 2021 at 19:25 Comment(0)
B
0

In my case

composer update doctrine/doctrine-bundle

Thanks IStranger

Bivouac answered 5/8, 2021 at 22:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.