omines / datatables-bundle

DataTables bundle for Symfony
https://omines.github.io/datatables-bundle/
MIT License
252 stars 113 forks source link

Cannot install using composer #191

Closed krstns closed 3 years ago

krstns commented 3 years ago

I've tried running the composer install today with the following result:


composer require omines/datatables-bundle
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Using version ^0.3.1 for omines/datatables-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.4.*"

  [ErrorException]
  Undefined index: extra

require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--unpack] [--] [<packages>]...

I've tried searching for solutions, found some similar issues with other projects but non of the possible fixes could be applied (I am not using packagist).

krewetka commented 3 years ago

@krstns try run it with -vvv and see stack trace. It might not be the cause of package you try to install but the one you already have.

Quick solution/workaround is to remove this restriction to 4.4.* from your composer.json ( somewhere at the end of it)

krstns commented 3 years ago

@krewetka thanks a lot for taking interest. i've used composer for a while but never had to debug it.

Writing /root/.composer/cache/repo/https---repo.packagist.org/provider-symfony$console.json into cache

  [ErrorException]
  Undefined index: extra

Exception trace:
 () at /app/vendor/symfony/flex/src/Cache.php:93
 Composer\Util\ErrorHandler::handle() at /app/vendor/symfony/flex/src/Cache.php:93
 Symfony\Flex\Cache->removeLegacyTags() at /app/vendor/symfony/flex/src/TruncatedComposerRepository.php:41
 Symfony\Flex\TruncatedComposerRepository->fetchFile() at phar:///opt/bitnami/php/bin/composer.phar/src/Composer/Repository/ComposerRepository.php:357
 Composer\Repository\ComposerRepository->whatProvides() at phar:///opt/bitnami/php/bin/composer.phar/src/Composer/Plugin/PluginManager.php(195) : eval()'d code:551
 class@anonymous\phar:///opt/bitnami/php/bin/composer.phar/src/Composer/Plugin/PluginManager.php(195) : eval()'d code0x7f955b8a9a06->whatProvides() at phar:///opt/bitnami/php/bin/composer.phar/src/Composer/DependencyResolver/Pool.php:204
 Composer\DependencyResolver\Pool->computeWhatProvides() at phar:///opt/bitnami/php/bin/composer.phar/src/Composer/DependencyResolver/Pool.php:193
 Composer\DependencyResolver\Pool->whatProvides() at phar:///opt/bitnami/php/bin/composer.phar/src/Composer/Plugin/PluginManager.php(195) : eval()'d code:574
 Symfony\Flex\Flex_composer_tmp1->Symfony\Flex\{closure}() at /app/vendor/symfony/flex/src/ParallelDownloader.php:278
 Symfony\Flex\ParallelDownloader->getNext() at /app/vendor/symfony/flex/src/ParallelDownloader.php:90
 Symfony\Flex\ParallelDownloader->download() at phar:///opt/bitnami/php/bin/composer.phar/src/Composer/Plugin/PluginManager.php(195) : eval()'d code:584
 Symfony\Flex\Flex_composer_tmp1->populateProvidersCacheDir() at n/a:n/a
 call_user_func() at phar:///opt/bitnami/php/bin/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:176
 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///opt/bitnami/php/bin/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:135
 Composer\EventDispatcher\EventDispatcher->dispatchInstallerEvent() at phar:///opt/bitnami/php/bin/composer.phar/src/Composer/Installer.php:471
 Composer\Installer->doInstall() at phar:///opt/bitnami/php/bin/composer.phar/src/Composer/Installer.php:228
 Composer\Installer->run() at phar:///opt/bitnami/php/bin/composer.phar/src/Composer/Command/RequireCommand.php:184
 Composer\Command\RequireCommand->execute() at /app/vendor/symfony/flex/src/Command/RequireCommand.php:68
 Symfony\Flex\Command\RequireCommand->execute() at phar:///opt/bitnami/php/bin/composer.phar/vendor/symfony/console/Command/Command.php:241
 Symfony\Component\Console\Command\Command->run() at phar:///opt/bitnami/php/bin/composer.phar/vendor/symfony/console/Application.php:843
 Symfony\Component\Console\Application->doRunCommand() at phar:///opt/bitnami/php/bin/composer.phar/vendor/symfony/console/Application.php:193
 Symfony\Component\Console\Application->doRun() at phar:///opt/bitnami/php/bin/composer.phar/src/Composer/Console/Application.php:254
 Composer\Console\Application->doRun() at phar:///opt/bitnami/php/bin/composer.phar/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at phar:///opt/bitnami/php/bin/composer.phar/src/Composer/Console/Application.php:103
 Composer\Console\Application->run() at phar:///opt/bitnami/php/bin/composer.phar/bin/composer:56
 require() at /opt/bitnami/php/bin/composer.phar:24

These are the last bits of the log and the stacktrace.

So I took your advice and removed the bit regarding 4.4.* restriction. Afterwards the installation went on but failed due to lack of memory.

So I've tried to increase it by running:

php -d memory_limit=-1 /opt/bitnami/php/bin/composer.phar -vvv require omines/datatables-bundle
Reading ./composer.json
Loading config file ./composer.json
[...]
Downloading http://repo.packagist.org/p/symfony/polyfill-php71%2437ef9c261c6e4e54f183b2a24427cdb9980faa9fffa40697fbef7cd7b192416d.json
Writing /root/.composer/cache/repo/https---repo.packagist.org/provider-symfony$polyfill-php71.json into cache
Reading /root/.composer/cache/repo/https---repo.packagist.org/provider-doctrine$mongodb-odm-bundle.json from cache
Reading /root/.composer/cache/repo/https---repo.packagist.org/provider-symfony$phpunit-bridge.json from cache
Killed

I guess the issue now is the memory on my docker container. Will try to increase the limit.

krewetka commented 3 years ago

So it is definitely flex problem. Problem with out of memory is quite known one for composer, that is why this restriction to selected symfony version was introduced.

As a quick workaround you can do fix this line in Cache.php. In newest version https://github.com/symfony/flex/blob/master/src/Cache.php you can see that this is check if extra is existing.

After quick workaround you should be able to upgrade at least flex to newer version ( so workaround is not needed).

curry684 commented 3 years ago

Not a bundle issue.