由于 symfony/flex,Composer 安装突然失败

Posted

技术标签:

【中文标题】由于 symfony/flex,Composer 安装突然失败【英文标题】:Composer install suddenly fails because of symfony/flex 【发布时间】:2021-08-14 03:52:26 【问题描述】:

我突然遇到了这个问题。我没有改变作曲家的任何东西,直到上周它运行得很好。现在,当我运行 composer install 时,我最后得到了这个:

Generating autoload files
ocramius/package-versions:  Generating version class...
ocramius/package-versions: ...done generating version class


  [ErrorException]
  Undefined index: vulnerabilities

这使我的部署崩溃,现在我无法在暂存或生产环境中发布任何内容。

我已经一一删除了软件包,并设法将问题追溯到 symfony/flex。我尝试更新它,但作曲家只是冻结了一个随机步骤,这对我来说毫无意义。

我已经尝试删除它并运行一个干净的composer require symfony/flex,以防我的版本出现问题 - 它会安装它然后尝试更新依赖项并永远冻结。

我试过了:

composer clearcache

composer self-update

composer update --no-plugins --noscripts

没有任何作用。它仍然在更新时冻结,并且仍然给我安装错误。我快要绝望了。

这是我的 composer.json 文件:


  "type": "project",
  "minimum-stability": "dev",
  "prefer-stable": true,
  "require": 
    "php": "^7.1.3",
    "ext-iconv": "*",
    "ext-json": "*",
    "ext-intl": "*",
    "beberlei/doctrineextensions": "^1.2",
    "brick/math": "0.7.*",
    "doctrine/doctrine-bundle": "^1.12.6",
    "dompdf/dompdf": "^0.8.2",
    "fervo/enum-bundle": "^2.2",
    "friendsofsymfony/jsrouting-bundle": "^2.1",
    "friendsofsymfony/rest-bundle": "^2.0",
    "friendsofsymfony/user-bundle": "^2.1.2",
    "knplabs/knp-snappy-bundle": "^1.5",
    "lexik/jwt-authentication-bundle": "^2.6",
    "nelmio/api-doc-bundle": "^3.6",
    "phpoffice/phpword": "^0.14.0",
    "predis/predis": "^1.1",
    "sc0vu/web3.php": "dev-master",
    "sensio/framework-extra-bundle": "^5.1",
    "sg/datatablesbundle": "v1.0.4",
    "simplethings/entity-audit-bundle": "^1.0",
    "snc/redis-bundle": "^2.0",
    "sonata-project/admin-bundle": "^3.49",
    "sonata-project/doctrine-orm-admin-bundle": "^3.4",
    "sonata-project/easy-extends-bundle": "^2.5",
    "sonata-project/user-bundle": "^4.1",
    "symfony/asset": "^4.0",
    "symfony/console": "^4.0",
    "symfony/debug-pack": "*",
    "symfony/expression-language": "^4.0",
    "symfony/flex": "v1.1",
    "symfony/form": "^4.0",
    "symfony/framework-bundle": "^4.0",
    "symfony/monolog-bundle": "^3.1",
    "symfony/orm-pack": "^1.0",
    "symfony/process": "^4.0",
    "symfony/security": "^4.0",
    "symfony/security-bundle": "^4.0",
    "symfony/security-csrf": "^v4.0",
    "symfony/serializer-pack": "*",
    "symfony/swiftmailer-bundle": "^3.1",
    "symfony/translation": "^4.0",
    "symfony/validator": "^4.0",
    "symfony/web-link": "^4.0",
    "symfony/webpack-encore-pack": "^1.0",
    "symfony/yaml": "^4.0",
    "twilio/sdk": "^5.0",
    "web3p/ethereum-tx": "^0.3.4",
    "willdurand/js-translation-bundle": "2.6.6"
  ,
  "require-dev": 
    "ext-json": "*",
    "behat/symfony2-extension": "^2.1.5",
    "doctrine/data-fixtures": "^1.3",
    "hautelook/alice-bundle": "^2.0",
    "phpmd/phpmd": "^2.6",
    "phpstan/phpstan": "^0.10.6",
    "squizlabs/php_codesniffer": "^3.3",
    "symfony/browser-kit": "^4.0",
    "symfony/css-selector": "^4.0",
    "symfony/dotenv": "^4.0",
    "symfony/maker-bundle": "^1.0",
    "symfony/phpunit-bridge": "~4.3.0",
    "symfony/profiler-pack": "*",
    "zitec/behat-extension": "dev-master@dev"
  ,
  "config": 
    "preferred-install": 
      "*": "dist"
    ,
    "sort-packages": true
  ,
  "autoload": 
    "psr-4": 
      "App\\": "src/"
    
  ,
  "autoload-dev": 
    "psr-4": 
      "App\\Tests\\": ["tests/functional", "test/unit", "tests/api"]
    
  ,
  "replace": 
    "symfony/polyfill-iconv": "*",
    "symfony/polyfill-php71": "*",
    "symfony/polyfill-php70": "*",
    "symfony/polyfill-php56": "*"
  ,
  "scripts": 
    "auto-scripts": 
      "cache:clear": "symfony-cmd",
      "cache:warmup": "symfony-cmd",
      "assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd"
    ,
    "post-install-cmd": [
      "@auto-scripts"
    ],
    "post-update-cmd": [
      "@auto-scripts"
    ]
  ,
  "conflict": 
    "symfony/symfony": "*"
  ,
  "extra": 
    "symfony": 
      "id": "04C3GOB2A6BKEGTJ93E6RLD8R5",
      "allow-contrib": true
    
  

我的作曲家版本是 1.10.22

composer update --vvv 在这些行之后冻结:

Downloading http://repo.packagist.org/p/athletic/athletic%247c468034c468fcf26e08cb4c4e42c29c6058991f243753f391bf4be1a93476f1.json
Writing /root/.composer/cache/repo/https---repo.packagist.org/provider-athletic$athletic.json into cache
Downloading http://repo.packagist.org/p/laminas/laminas-stdlib%243063fe25485f2f11f7dcdae0d6592d8c4740bd0e4c6fbf5fac7141542cc10d34.json
Writing /root/.composer/cache/repo/https---repo.packagist.org/provider-laminas$laminas-stdlib.json into cache
Downloading http://repo.packagist.org/p/zendframework/zend-hydrator%24929a25c4d947fc57e2c18901b036ca54a167be6e1ac3b7a7ebc22757a91784a3.json
Writing /root/.composer/cache/repo/https---repo.packagist.org/provider-zendframework$zend-hydrator.json into cache
Downloading http://repo.packagist.org/p/laminas/laminas-hydrator%24a55a80ba78a25b92b6156070846ea5bcd90dfa7fc7c51c707f62695d865e56ab.json
Writing /root/.composer/cache/repo/https---repo.packagist.org/provider-laminas$laminas-hydrator.json into cache

有没有人知道可能是什么原因造成的,或者我可以尝试什么?非常感谢,非常感谢!

【问题讨论】:

正如***.com/questions/67366109/… 中已经评论的那样:这看起来像是来自两年多前的symfony/flex 的代码。如果你运行 composer update symfony/flex 会发生什么? 如果我运行 composer update symfony/flex,它会在我上面粘贴的行之后永远挂起(最后一个代码块)。 您尝试过什么解决问题的方法?您使用的是哪个 PHP 版本?您是否尝试过使用 Composer v2? 我使用的是 PHP 7.2.34,我尝试删除整个供应商文件夹,然后使用 symfony/flex v1.12.2 或更高版本。没用。我尝试升级到 Composer 2 - 它告诉我我需要升级我的包,因为有些包不兼容,然后当我尝试运行更新时,它又再次挂起...... @MichaelCameron 好吧,是的,也不是。我注意到较旧的分支似乎可以工作,并且 Git 将 symfony.lock 识别为不同之处,尽管它无法告诉我它到底有什么不同。它看起来几乎一样。无论如何,我将该文件从旧分支复制到新分支,并且它有效。奇怪但很好...... 【参考方案1】:

symfony/flexv1.1.8 有同样的问题,将其更新为v1.17.2,问题就解决了。

要更新它,只需运行: composer update symfony/flex

【讨论】:

以上是关于由于 symfony/flex,Composer 安装突然失败的主要内容,如果未能解决你的问题,请参考以下文章

无法安装探查器symfony flex

sh Symfony Flex可用吗?使用此脚本创建一个crontab,每分钟执行一次并保持关注!

Symfony 4.4 - 自定义错误模板不起作用

由于稳定性,Composer拒绝包

由于Composer,Capistrano部署中止

GitHub Actions - Composer 由于 PHP 版本限制而失败