程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了安装 Symfony 时出错,声明 DependencyInjection PSR php,怎么办?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决安装 Symfony 时出错,声明 DependencyInjection PSR php,怎么办??

开发过程中遇到安装 Symfony 时出错,声明 DependencyInjection PSR php,怎么办?的问题如何解决?下面主要结合日常开发的经验,给出你关于安装 Symfony 时出错,声明 DependencyInjection PSR php,怎么办?的解决方法建议,希望对你解决安装 Symfony 时出错,声明 DependencyInjection PSR php,怎么办?有所启发或帮助;

使用: symfony 新 my_project_nasdame --version=lts@H_618_5@

[或]@H_618_5@

作曲家创建项目 symfony/website-skeleton my_project_name@H_618_5@

[或]@H_618_5@

symfony 新 test_project332@H_618_5@

php7.4@H_618_5@

到处都是错误@H_618_5@

    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] $

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

需要帮助@H_618_5@

解决方法

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

大佬总结

以上是大佬教程为你收集整理的安装 Symfony 时出错,声明 DependencyInjection PSR php,怎么办?全部内容,希望文章能够帮你解决安装 Symfony 时出错,声明 DependencyInjection PSR php,怎么办?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。