1

I tried creating new laravel project using composer but am getting the above error. Any help?

This is the command I used: "composer create-project --prefer-dist laravel/laravel project-name"

Some Output errors: Class Symfony\Component\Translation\Tests\DependencyInjection\TranslatorPassTest located in ./vendor/symfony/translation/TranslatorPassTest.php does not comply with psr-4 autoloading standard. Skipping.

Class Symfony\Component\Translation\Loader\ArrayLoader located in ./vendor/symfony/translation/ArrayLoader.php does not comply with psr-4 autoloading standard. Skipping.

Class Symfony\Component\Translation\Tests\Provider\NullProviderFactoryTest located in ./vendor/symfony/translation/Provider/NullProviderFactoryTest.php does not comply with psr-4 autoloading standard. Skipping.

7
  • 1
    What have you already done, tried? What commands have you used to create new project? Commented Sep 28, 2021 at 9:24
  • I have tried this command "composer create-project --prefer-dist laravel/laravel project-name". Thanks. Commented Sep 28, 2021 at 9:27
  • Check the entire output and see if there were any errors installing any of the dependencies Commented Sep 28, 2021 at 9:29
  • See github.com/symfony/symfony/issues/43212 - this is a pretty new, but already known bug Commented Sep 28, 2021 at 9:53
  • I can see I am not alone. Basically initial version (i.e "symfony/translation": "v5.3.7") would work for now. Commented Sep 28, 2021 at 10:01

4 Answers 4

2

Until the namespace change is accounted for you can temporarily set

"symfony/translation": "v5.3.7"

Update it with composer update and it should work again.

Sign up to request clarification or add additional context in comments.

Comments

2

The package has been updated to:

"symfony/translation": "v5.3.9"

and it is working well.

https://github.com/symfony/translation/releases/tag/v5.3.9

Comments

0

I have reverted my composer.lock and then just composer install. It seams that the translator new update is not properly set. For new installations the solution should be what the user3672987 gave as temp solution.

1 Comment

That's a temporary solution.
-1

Temporary solution :

You can quick fix it by adding temporarily this line to your composer.json

"symfony/translation": "v5.3.7",


Initial answer :

Same for me, got this error when I'm trying to install a new project or using composer install or composer update on any project :

> @php artisan package:discover --ansi

   Error 

  Class "Symfony\Component\Translation\Loader\ArrayLoader" not found

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

      +13 vendor frames 
  14  [internal]:0
      Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(Carbon\Laravel\ServiceProvider))

      +5 vendor frames 
  20  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Edit :

Apparently, the package symfony/translation had a minor release that changed the namespace of ArrayLoader :

https://github.com/symfony/translation/releases/tag/v5.3.8

https://github.com/briannesbitt/Carbon/issues/2466

1 Comment

Same here.. Seems like there is a bug or something with the latest update

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.