通过 composer 创建新的 Laravel 项目失败,错误类 ArrayLoader not found [英] Creating new laravel project via composer fails with error class ArrayLoader not found

查看:26
本文介绍了通过 composer 创建新的 Laravel 项目失败,错误类 ArrayLoader not found的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我为 laravel 创建一个新的 Composer 项目时

When I create a new composer project for laravel

composer create-project laravel/laravel laravel

我收到以下错误

> @php artisan package:discover --ansi

   Error

  Class 'SymfonyComponentTranslationLoaderArrayLoader' not found

  at vendor/nesbot/carbon/src/Carbon/Translator.php:80
     76▕     public function __construct($locale, TranslationFormatterMessageFormatterInterface $formatter = null, $cacheDir = null, $debug = false)
     77▕     {
     78▕         $this->initializing = true;
     79▕         $this->directories = [__DIR__.'/Lang'];
  ➜  80▕         $this->addLoader('array', new TranslationLoaderArrayLoader());
     81▕         parent::__construct($locale, $formatter, $cacheDir, $debug);
     82▕         $this->initializing = false;
     83▕     }
     84▕

      +13 vendor frames
  14  [internal]:0
      IlluminateFoundationApplication::IlluminateFoundation{closure}()

      +5 vendor frames
  20  artisan:37
      IlluminateFoundationConsoleKernel::handle()
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

我在 PHP 7.4.24 docker 容器 (macOS) 中使用最新的稳定版 Composer (2.1.8) 运行它.

I run it inside PHP 7.4.24 docker container (macOS) with the latest stable composer (2.1.8).

完整日志 https://pastebin.pl/view/bb4ae413

推荐答案

好像很多人有同样的问题

Seems many people have the same issue

暂时手动降级到 symfony/translate 5.3.7 或更低版本

Downgrade temporarilyy and manually to symfony/translate 5.3.7 or lower

这篇关于通过 composer 创建新的 Laravel 项目失败,错误类 ArrayLoader not found的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆