, ,

How to fix the error “In order to use the Auth::routes() method, please install the laravel/ui package” in laravel 10

Posted by

Error

 RuntimeException 

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

  at vendor\laravel\framework\src\Illuminate\Support\Facades\Auth.php:93
     89▕      */
     90▕     public static function routes(array $options = [])
     91▕     {
     92▕         if (! static::$app->providerIsLoaded(UiServiceProvider::class)) {
  ➜  93▕             throw new RuntimeException('In order to use the Auth::routes() method, please install the laravel/ui package.');
     94▕         }
     95▕
     96▕         static::$app->make('router')->auth($options);
     97▕     }

  1   routes\web.php:23
      Illuminate\Support\Facades\Auth::routes()
  2   vendor\laravel\framework\src\Illuminate\Routing\RouteFileRegistrar.php:35

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

Solution:

It indicates that you need to install the Laravel/ui package in order to use the Auth::routes() method.

To resolve this issue, you can follow these steps:

Step 1: Install the laravel/ui package using Composer:

composer require laravel/ui

Step 2: Generate authentication scaffolding for it.

For Bootstrap-based scaffolding:

php artisan ui bootstrap --auth

For Vue.js-based scaffolding:

php artisan ui vue --auth

For React-based scaffolding:

php artisan ui react --auth

Step 3: Use Auth::routes() in routes/web.php

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x