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

后端 未结 14 2119
孤街浪徒
孤街浪徒 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:36

    nothing worked. So I installed a new project, and I read Handler.php in App\Exceptions, it was different, probably because I copied some solution and Internet and deleted the following:

    protected $dontReport = [
        //
    ];
    
    protected $dontFlash = [
        'password',
        'password_confirmation',
    ];
    

    I copy here all of Handler.php generated by laravel 7.5, may be useful for someone:

    <?php
    
    namespace App\Exceptions;
    
    use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
    use Throwable;
    
    class Handler extends ExceptionHandler
    {
        /**
         * A list of the exception types that are not reported.
         *
         * @var array
         */
        protected $dontReport = [
            //
        ];
    
    /**
     * A list of the inputs that are never flashed for validation exceptions.
     *
     * @var array
     */
    protected $dontFlash = [
        'password',
        'password_confirmation',
    ];
    
    /**
     * Report or log an exception.
     *
     * @param  \Throwable  $exception
     * @return void
     *
     * @throws \Exception
     */
    public function report(Throwable $exception)
    {
        parent::report($exception);
    }
    
    /**
     * Render an exception into an HTTP response.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Throwable  $exception
     * @return \Symfony\Component\HttpFoundation\Response
     *
     * @throws \Throwable
     */
    public function render($request, Throwable $exception)
    {
        return parent::render($request, $exception);
    }
    

    }

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

    This happens because you have upgraded to Laravel 7.

    To fix it, update app/Exceptions/Handler.php like so:

    <?php
    
    namespace App\Exceptions;
    
    use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
    use Throwable; // <-- ADD THIS
    
    class Handler extends ExceptionHandler
    {
        public function report(Throwable $exception) // <-- USE Throwable HERE
        {
            parent::report($exception);
        }
        public function render($request, Throwable $exception) // AND HERE
        {
            return parent::render($request, $exception);
        }
    }
    

    This is documented in the official upgrade guide here:

    https://laravel.com/docs/7.x/upgrade#symfony-5-related-upgrades

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

    This is not an actual error. If you look a bit above you'll see the actual error. In my case, there was an error in my code:

    PHP Fatal error:  Declaration of 
    App\Exceptions\Handler::render($request, App\Exceptions\Exception $exception)
    must be compatible with 
    Illuminate\Foundation\Exceptions\Handler::render($request, Throwable $e)
    

    It is not possible to tell you what is actually a problem in your code, so you have to look real reason for this error in your stack trace.

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

    Same issue when I update laravel from 6.x to 7.x

    I tried the most voted answer but it didn't work, then I used php artisan serve I noticed that:

    RuntimeException
    
    In order to use the Auth::routes() method, please install the laravel/ui package.
    

    Try composer require laravel/ui maybe it will work.

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

    Hello everybody/ hello world. I solved my problem that way:


    I deleted my project I created a new folder and cloned the repository again and after that I gave composer install / update

    good luck.

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

    I got the same problem in Win 8 and solve it:

    Here is the steps.

    Step-1: Go to your project directory

    Step-2: And type command cd bootstrap/cache/

    Step-3: Again type command del -rf *.php

    Step-4: Update your composer composer update

    Step-5: Now you are done: php artisan serve

    Thanks.

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