phpstorm本地执行artisan命令总是报错,在命令行进入homestead环境里执行是成功的。求解决?

php artisan报以下错误:

fangze:larabbs ye$ php artisan

   ErrorException 

  Use of undefined constant JSON_INVALID_UTF8_SUBSTITUTE - assumed 'JSON_INVALID_UTF8_SUBSTITUTE'

  at vendor/laravel/framework/src/Illuminate/Log/LogManager.php:416
    412|      * @return \Monolog\Formatter\FormatterInterface
    413|      */
    414|     protected function formatter()
    415|     {
  > 416|         return tap(new LineFormatter(null, $this->dateFormat, true, true), function ($formatter) {
    417|             $formatter->includeStacktraces();
    418|         });
    419|     }
    420| 

      +8 vendor frames 
  9   app/Exceptions/Handler.php:39
      Illuminate\Foundation\Exceptions\Handler::report(Object(Symfony\Component\ErrorHandler\Error\FatalError))

      +3 vendor frames 
  13  [internal]:0
      Illuminate\Foundation\Bootstrap\HandleExceptions::handleShutdown()

   Whoops\Exception\ErrorException 

  Declaration of Carbon\Translator::setLocale($locale) must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface::setLocale(string $locale)

  at vendor/nesbot/carbon/src/Carbon/Translator.php:18
    14| use ReflectionException;
    15| use ReflectionFunction;
    16| use Symfony\Component\Translation;
    17| 
  > 18| class Translator extends Translation\Translator
    19| {
    20|     /**
    21|      * Translator singletons for each language.
    22|      *

      +1 vendor frames 
  2   [internal]:0
      Whoops\Run::handleShutdown()
懒惰的大叔
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
最佳答案

升级一下PHP版本吧,我用PHP7.1运行 laravel 6+报错,换php7.2好了

3年前 评论
讨论数量: 2

升级一下PHP版本吧,我用PHP7.1运行 laravel 6+报错,换php7.2好了

3年前 评论

在PHPstorm执行命令是执行的本地命令吧,homestead里面执行时虚拟机,环境不一样

3年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!