Flex: Error while installing symfony/flex

Created on 6 Apr 2018  路  4Comments  路  Source: symfony/flex

I just bumped into this issue while trying to install flex.

~/work/websites/www.audiencehero.localhost (master鈫戔殹) composer update --no-scripts --prefer-stable                                                                                                                                                         !11405
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 18 updates, 0 removals
  - Installing symfony/flex (v1.0.78): Loading from cache
PHP Fatal error:  Uncaught Error: Cannot use object of type Composer\Repository\VcsRepository as array in /Users/marc/work/websites/www.audiencehero.localhost/vendor/symfony/flex/src/Flex.php:635
Stack trace:
#0 /Users/marc/work/websites/www.audiencehero.localhost/vendor/symfony/flex/src/Flex.php(180): Symfony\Flex\Flex->populateRepoCacheDir()
#1 phar:///usr/local/bin/composer/src/Composer/Plugin/PluginManager.php(236): Symfony\Flex\Flex->activate(Object(Composer\Composer), Object(Composer\IO\ConsoleIO))
#2 phar:///usr/local/bin/composer/src/Composer/Plugin/PluginManager.php(205): Composer\Plugin\PluginManager->addPlugin(Object(Symfony\Flex\Flex))
#3 phar:///usr/local/bin/composer/src/Composer/Installer/PluginInstaller.php(63): Composer\Plugin\PluginManager->registerPackage(Object(Composer\Package\CompletePackage), true)
#4 phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php(173): Composer\Installer\PluginInstaller->install(Object(Composer\Repository\InstalledFilesystemRepository), Object(Composer\Pac in /Users/marc/work/websites/www.audiencehero.localhost/vendor/symfony/flex/src/Flex.php on line 635

Fatal error: Uncaught Error: Cannot use object of type Composer\Repository\VcsRepository as array in /Users/marc/work/websites/www.audiencehero.localhost/vendor/symfony/flex/src/Flex.php:635
Stack trace:
#0 /Users/marc/work/websites/www.audiencehero.localhost/vendor/symfony/flex/src/Flex.php(180): Symfony\Flex\Flex->populateRepoCacheDir()
#1 phar:///usr/local/bin/composer/src/Composer/Plugin/PluginManager.php(236): Symfony\Flex\Flex->activate(Object(Composer\Composer), Object(Composer\IO\ConsoleIO))
#2 phar:///usr/local/bin/composer/src/Composer/Plugin/PluginManager.php(205): Composer\Plugin\PluginManager->addPlugin(Object(Symfony\Flex\Flex))
#3 phar:///usr/local/bin/composer/src/Composer/Installer/PluginInstaller.php(63): Composer\Plugin\PluginManager->registerPackage(Object(Composer\Package\CompletePackage), true)
#4 phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php(173): Composer\Installer\PluginInstaller->install(Object(Composer\Repository\InstalledFilesystemRepository), Object(Composer\Pac in /Users/marc/work/websites/www.audiencehero.localhost/vendor/symfony/flex/src/Flex.php on line 63

All 4 comments

fixed

Just wanted to create a fresh new project and also got an install error:

$ composer create-project symfony/website-skeleton xxx
Installing symfony/website-skeleton (v4.0.5)
  - Installing symfony/website-skeleton (v4.0.5): Downloading (100%)
Created project in xxx
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 90 installs, 0 updates, 0 removals
  - Installing ocramius/package-versions (1.3.0): Loading from cache
  - Installing symfony/flex (v1.0.78): Downloading (100%)
PHP Fatal error:  Cannot declare class Symfony\Flex\Command\RemoveCommand, because the name is already in use in C:\htdocs\xxx\vendor\symfony\flex\src\Command\RemoveCommand.php on line 36

Fatal error: Cannot declare class Symfony\Flex\Command\RemoveCommand, because the name is already in use in C:\htdocs\xxx\vendor\symfony\flex\src\Command\RemoveCommand.php on line 36

edit

because the name is already in use

So I tried deleting the vendor folder that was outside of my project (possibly from other projects?) and that allowed me to install correctly.

Usually, that happens when you try to create a project within another one.

It was a conflict with wikimedia/composer-merge-plugin. I had to remove the composer-merge-plugin specific section of the composer.json file, and then install flex.

If you use window, you should start wampserver before.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

javiereguiluz picture javiereguiluz  路  6Comments

c33s picture c33s  路  7Comments

Deltachaos picture Deltachaos  路  5Comments

eb22fbb4 picture eb22fbb4  路  8Comments

soullivaneuh picture soullivaneuh  路  6Comments