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

后端 未结 14 2121
孤街浪徒
孤街浪徒 2020-12-03 05:09

I moved my project from desk to another.
When I run php artisan it does not work.

I tried to run composer update, but it returns the

相关标签:
14条回答
  • 2020-12-03 05:49

    maybe you have an error in the project code (for example, in routes or controller). This may be one of the reasons for this error.

    In my project, the web.php file has a syntax error. I defined this when I started the php artisan command

    C:\OSPanel\domains\lara.shop.loc>php artisan
    In web.php line 
      syntax error, unexpected end of file  
    
    0 讨论(0)
  • 2020-12-03 05:51

    Do you have .env file in your new project?

    I had same error message. When I add .env file, error is gone.

    success message like this.

    Generating optimized autoload files
    > Illuminate\Foundation\ComposerScripts::postAutoloadDump
    > @php artisan package:discover
    Discovered Package: fideloper/proxy
    Discovered Package: ixudra/curl
    Discovered Package: laravel/tinker
    Discovered Package: nesbot/carbon
    Discovered Package: socialiteproviders/manager
    Package manifest generated successfully.
    

    I hope this will help you.

    0 讨论(0)
  • 2020-12-03 05:51

    I was upgrading my Laravel from 5.8 to 8.0 and I got this error.

    So my fixes were

    1. As @nobuhiroharada mentioned that I had missed .env file in my project

    2. Second is that Laravel removed Exception and replaced it with Throwable. So we need to fix that in our app\Exceptions\Handler.php. One can refer Medium.com for the error fix.

    3. In the upgrade guide of Laravel 8.x you need to update the dependencies like this

    4. Next, in your composer.json file, remove classmap block from the autoload section and add the new namespaced class directory mappings:

    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },

    1. Finally from bootstrap\cache delete the cache files and run composer update.

    These 5 steps might help you remove the error you are facing in your Laravel Project.

    0 讨论(0)
  • 2020-12-03 05:53

    This is how I solved this after an upgrade from laravel version 6.x - 7.x:

    In App\Exceptions\Handler changed

    //Use Exception;
    Use Throwable;
    

    Then methods to accept instances of Throwable instead of Exceptions as follows:

    //public function report(Exception$exception);
    public function report(Throwable $exception);
    
    //public function render($request, Exception $exception);
    public function render($request, Throwable $exception);
    

    In config\session.php:

    //'secure' => env('SESSION_SECURE_COOKIE', false),
    'secure' => env('SESSION_SECURE_COOKIE', null),
    

    Then run composer update

    0 讨论(0)
  • 2020-12-03 05:53

    I solved the problem this way:

    cd bootstrap/cache/
    rm -rf *.php
    

    The bootstrap directory contains the app.php file that initializes the structure. This directory also houses a cache directory that contains structure-generated files for performance optimization, such as files and route cache services. Laravel stores configuration files, provider, and cached services to optimize the fetching of this information. The problem with me was when the other developer ran the 'php artisan config: cache' command on your machine and since the cache folder contains files that can be deleted, I deleted them and solved the problem.

    0 讨论(0)
  • 2020-12-03 05:54

    I solve this error by deleting the vendor table then run composer update. I'm using Laravel 7. So, if you are not updating from the older Laravel version, maybe this is the solution.

    0 讨论(0)
提交回复
热议问题