Php 如何使用Composer和Symfony解决255错误

Php 如何使用Composer和Symfony解决255错误,php,symfony,composer-php,Php,Symfony,Composer Php,我的Composer有问题,当我运行Composer安装命令时,出现一个错误255 以下是我为解决此问题所做的工作: 我更新了Composer,错误出现在版本1和版本2中 composer同步配方-v--force 重新安装synfony 5 更新了电脑 我正在运行Ubuntu 20.04 错误详细信息: Don't forget to run npm install --force or yarn install --force to refresh your JavaScript dep

我的Composer有问题,当我运行
Composer安装
命令时,出现一个错误255

以下是我为解决此问题所做的工作:

  • 我更新了Composer,错误出现在版本1和版本2中
  • composer同步配方-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需要symfony/服务合同:2.2.0


:)

在我看来,这并不是Composer本身的问题,而是安装的软件包的问题。请分享更多关于它们的详细信息有帮助吗?命令行上的错误255就像网页上的错误500,它告诉不了你多少。您需要查看的实际错误是输出中以“PHP致命错误”开头的一行。感谢Nico Haase,这是我的工作!作为一个提示:简单地更新给定的包而不是手动要求它可能是好的,特别是如果您设置了如此严格的版本约束