安装 Symfony 、声明 DependencyInjection PSR php 时出错,该怎么办?

Gre*_*Cat 6 dependency-injection declaration symfony

使用: symfony new my_project_nasdame --version=lts

[或者]

作曲家创建项目 symfony/网站骨架 my_project_name

[或者]

symfony 新 test_project332

PHP7.4

到处都是错误

    lexcodfh@artek:~/tmp [130] $ ~/.symfony/bin/symfony new test_new_project
    * Creating a new Symfony project with Composer
     [KO]
Script cache:clear returned with error code 255
!!
!!  Fatal error: Declaration of Symfony\Component\DependencyInjection\ServiceLocator::has(string $id) must be compatible with Psr\Container\ContainerInterface::has($id) in /home/l/lexcodfh/tmp/test_new_project/vendor/symfony/dependency-injection/ServiceLocator.php on line 46
!!  Symfony\Component\ErrorHandler\Error\FatalError {#89
!!    -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/l/lexcodfh/tmp/test_new_project/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-update-cmd


  unable to run /home/l/lexcodfh/.local/bin/composer create-project symfony/skeleton /home/l/lexcodfh/tmp/test_new_project  --no-interaction: exit status 255
    
    lexcodfh@artek:~/tmp [1] $
Run Code Online (Sandbox Code Playgroud)

不适用于托管的解决方案: https ://github.com/symfony/symfony/issues/40393

需要帮忙

小智 6

apt remove php7.4-psr php-psr对基于 Debian 的发行版使用该命令

  • 要为所有已安装的 PHP 版本删除此选项,请执行以下操作:`apt remove php*-psr`。 (4认同)