skip to Main Content

I have been working on a Laravel 7 project since a while. Suddenly, my composer install returns the following error

Generating optimized autoload files
Class ModulesTestsThumbnailTest located in ./Modules/Media/Tests/ThumbnailTest.php does not comply with psr-4 autoloading standard. Skipping.
> IlluminateFoundationComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
                                       
  An option shortcut cannot be empty.                                     

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Laravel version: 7.2
php 7.2
OS: Ubuntu

I have made thousands of installs suddenly this error is holding up my project.

The below is stacktrace of the error

[2024-02-01 08:39:00] local.ERROR: An option shortcut cannot be empty. {"exception":"[object] (Symfony\Component\Console\Exception\InvalidArgumentException(code: 0): An option shortcut cannot be empty. at /home/myproject/vendor/symfony/console/Input/InputOption.php:85)
[stacktrace]
#0 /home/myproject/vendor/symfony/console/Command/Command.php(459): Symfony\Component\Console\Input\InputOption->__construct()
#1 /home/myproject/vendor/laravel/framework/src/Illuminate/Console/Concerns/HasParameters.php(32): Symfony\Component\Console\Command\Command->addOption()
#2 /home/myproject/vendor/laravel/framework/src/Illuminate/Console/Command.php(85): Illuminate\Console\Command->specifyParameters()
#3 [internal function]: Illuminate\Console\Command->__construct()
#4 /home/myproject/vendor/laravel/framework/src/Illuminate/Container/Container.php(849): ReflectionClass->newInstanceArgs()
#5 /home/myproject/vendor/laravel/framework/src/Illuminate/Container/Container.php(691): Illuminate\Container\Container->build()
#6 /home/myproject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(796): Illuminate\Container\Container->resolve()
#7 /home/myproject/vendor/laravel/framework/src/Illuminate/Container/Container.php(637): Illuminate\Foundation\Application->resolve()
#8 /home/myproject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(781): Illuminate\Container\Container->make()
#9 /home/myproject/vendor/laravel/framework/src/Illuminate/Console/Application.php(261): Illuminate\Foundation\Application->make()
#10 /home/myproject/vendor/laravel/framework/src/Illuminate/Console/Application.php(275): Illuminate\Console\Application->resolve()
#11 /home/myproject/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php(333): Illuminate\Console\Application->resolveCommands()
#12 /home/myproject/vendor/laravel/framework/src/Illuminate/Console/Application.php(152): Illuminate\Support\ServiceProvider->Illuminate\Support\{closure}()
#13 /home/myproject/vendor/laravel/framework/src/Illuminate/Console/Application.php(75): Illuminate\Console\Application->bootstrap()
#14 /home/myproject/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(330): Illuminate\Console\Application->__construct()
#15 /home/myproject/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Foundation\Console\Kernel->getArtisan()
#16 /home/myproject/artisan(37): Illuminate\Foundation\Console\Kernel->handle()
#17 {main}
"} 

All my artisan commands return the same error: "An option shortcut cannot be empty"

Recently, I upgraded to Laravel 7. I have followed the upgrade guide. But this error stack is not giving me any hint where the problem lies.

3

Answers


    1. check psr-4 mapping your composer.json file.
    2. correct that and delete composer.lock file
    3. then run composer install
    Login or Signup to reply.
  1. It is due to recent change of Symfony framework and issue is occurring in laravel-modules package.
    Fix has been done in Both but we need to wait either one to release it.
    https://github.com/symfony/symfony/pull/53711
    https://github.com/nWidart/laravel-modules/issues/1728

    Login or Signup to reply.
  2. Since this happens because of a change in the latest release of symfony/console, and a new version that reverts this change should be released shortly (but not immediately), you can simply tell composer to avoid installing this particular version.

    In this case, add the following to your composer.json:

    "conflict": {
        "symfony/console": "5.4.35"
      }
    

    (If you already have a conflict key in there, just add the symfony/console line).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search