【问题标题】:Getting error after running php artisan cache:clear Declaration of Symfony\Component\Translation\TranslatorInterface::setLocale($locale)运行 php artisan cache:clear Declaration of Symfony\Component\Translation\TranslatorInterface::setLocale($locale) 后出现错误
【发布时间】:2020-01-13 00:39:05
【问题描述】:

运行后php artisan cache:clear

我收到错误:

声明 Symfony\Component\Translation\TranslatorInterface::setLocale($locale) 必须与 Symfony\Contracts\Translation\LocaleAwareInterface::setLocale(string $locale) 兼容

【问题讨论】:

  • 你的 php 版本laravel 框架版本 是什么?
  • php 7.1 & laravel 5.8
  • 请附上您有问题的composer.json文件

标签: php laravel laravel-5


【解决方案1】:

我遇到了同样的错误

我通过添加解决了它

"symfony/translation": "4.3.8"

到我的 composer.json 文件

然后运行 composer update

之后一切正常

【讨论】:

  • 只有在你不能升级你的php版本时才使用这个
【解决方案2】:

11 天前(2019 年 12 月 1 日)不支持 PHP 版本(7.1):LINK

解决方案:使用最新版本更新您的 PHP

【讨论】:

  • 试试@Ranjeet
  • @Ranjeet 发生了什么?问题解决了还是仍然面临错误?
【解决方案3】:

进行以下更改-

  1. "symfony/translation": "4.3.8" 在你的composer.json
  2. 运行composer update

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-05-18
    • 2020-05-29
    • 2021-07-02
    • 2019-04-13
    • 2022-01-05
    • 2020-05-25
    • 2021-12-11
    相关资源
    最近更新 更多