【发布时间】: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