【问题标题】:How to solve error 255 with Composer and Symfony [closed]如何使用 Composer 和 Symfony 解决错误 255 [关闭]
【发布时间】:2021-07-14 17:15:59
【问题描述】:

我的 Composer 有问题,当我运行composer install 命令时,出现错误 255。

以下是我为解决此问题所做的任务:

  • 我更新了 Composer,错误出现在版本 1 和 2 中
  • composer sync-recipes -v --force
  • 重新安装了 synfony 5
  • 更新了电脑

我正在运行 Ubuntu 20.04。

错误详情:

Don't forget to run npm install --force or yarn install --force to refresh your JavaScript dependencies!
Run composer recipes at any time to see the status of your Symfony recipes.

Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 255
!!  PHP Fatal error:  Declaration of Symfony\Component\DependencyInjection\ServiceLocator::has(string $id) must be compatible with Psr\Container\ContainerInterface::has($id) in /home/massi/Projets/projet-RH/vendor/symfony/dependency-injection/ServiceLocator.php on line 46
!!  Symfony\Component\ErrorHandler\Error\FatalError {#92
!!    -error: array:4 [
!!      "type" => 64
!!      "message" => "Declaration of Symfony\Component\DependencyInjection\ServiceLocator::has(string $id) must be compatible with Psr\Container\ContainerInterface::has($id)"
!!      "file" => "/home/massi/Projets/projet-RH/vendor/symfony/dependency-injection/ServiceLocator.php"
!!      "line" => 46
!!    ]
!!    #message: "Compile Error: Declaration of Symfony\Component\DependencyInjection\ServiceLocator::has(string $id) must be compatible with Psr\Container\ContainerInterface::has($id)"
!!    #code: 0
!!    #file: "./vendor/symfony/dependency-injection/ServiceLocator.php"
!!    #line: 46
!!  }
!!  
Script @auto-scripts was called via post-install-cmd

【问题讨论】:

  • 在我看来这不是 Composer 本身的问题,而是已安装软件包的问题。请分享有关他们的更多详细信息
  • 命令行上的错误 255 就像网页上的错误 500 一样,它不会告诉你太多。您需要查看的实际错误是该输出中以“PHP 致命错误”开头的行。
  • 感谢 Nico Haase,它对我有用!

标签: php symfony composer-php


【解决方案1】:

最近更新的包有问题

composer require symfony/service-contracts:2.2.0

:)

【讨论】:

  • 作为一个提示:简单地更新给定的包而不是手动要求它可能很好,特别是如果你设置了如此严格的版本约束
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-03-31
  • 2014-03-19
  • 2015-03-23
  • 2014-09-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多