Symfony 2.6 error after using composer: "Vendor libraries must be installed"

After creating or updating the Symfony 2.6.1 project with the composer, I get the error "The library providers must be installed" and he suggests running php composer.phar install to php composer.phar install them.

The exact steps that I take: -

 composer create-project symfony/framework-standard-edition my_new_project/ cd my_new_project 

It seems to start without any problems, and, as far as I can tell, it downloads all the necessary vendor packages. However, if I then run: -

 php app/check.php 

The result is: -

* Supplier libraries must be installed
> No vendor libraries. Install composer after
> instructions at http://getcomposer.org/ . Then run php
> composer.phar install "to install them.

I tried to run composer update , composer install , deleting the composer's cache, but none of what I have tried so far resolves this error.

From testing multiple versions of Symfony, I get this error with all versions of Symfony> = 2.5.0. Any project that I create in the same way using Symfony <= 2.4.8 works just fine.

I am running PHP 5.6.4 (installed via MacPorts) on OS X.

I'm a little noob when it comes to composer, so any help would be greatly appreciated!

+5
source share
1 answer

This problem is here:

 /** * In some special setups, the vendor/ directory isn't located in the project's * root directory. To make this command work for every case, read Composer's * vendor/ directory location directly from composer.json file. * * @return string */ private function getComposerVendorDir() { $composerJson = json_decode(file_get_contents(__DIR__.'/../composer.json')); if (isset($composerJson->config)) { return $composerJson->config->{'vendor-dir'}; } return __DIR__.'/../vendor/composer'; } 

In particular:

 return $composerJson->config->{'vendor-dir'}; 

The condition on isset($composerJson->config) returns true, which leads to the above statement. However, when you look at the generated composer .json:

 "config": { "bin-dir": "bin" }, 

Missing vendor-dir . Create Notification:

 PHP Notice: Undefined property: stdClass::$vendor-dir 

Therefore, the function returns null, so this requirement is not met:

 $this->addRequirement( is_dir($this->getComposerVendorDir()), // <-- HERE 'Vendor libraries must be installed', 'Vendor libraries are missing. Install composer following instructions from <a href="http://getcomposer.org/">http://getcomposer.org/</a>. '. 'Then run "<strong>php composer.phar install</strong>" to install them.' ); 

This is a bug in symfony/symfony-standard . Most likely it has already been fixed, but you can also bring it up on Github.

EDIT:

It looks like they already have 2.7 uses:

 $this->addRequirement( is_dir(__DIR__.'/../vendor/composer'), 'Vendor libraries must be installed', 'Vendor libraries are missing. Install composer following instructions from <a href="http://getcomposer.org/">http://getcomposer.org/</a>. '. 'Then run "<strong>php composer.phar install</strong>" to install them.' ); 

There is nothing wrong with your project, it's just a mistake in the standard version. As long as you automatically load the classes, you're fine.

+5
source

Source: https://habr.com/ru/post/1210263/


All Articles