Laravel 9 require laravel/ui to use Auth::routes
Asked Answered
A

5

7

I am upgrading my project to Laravel 9. However, when I tried to run php artisan, I got an error message.

In Auth.php line 60: To use the Auth::routes() method, please install the laravel/ui package.

So I install the package, but I still get the same error message. What might be the problem, and how can I fix it?

Awlwort answered 19/3, 2022 at 10:26 Comment(0)
L
13

Step 1: (Install Laravel UI)

composer require laravel/ui

Step 2: (Generate Auth UI)

php artisan ui bootstrap --auth

Also please read the documentation: https://github.com/laravel/ui/blob/3.x/README.md

Latonialatoniah answered 20/3, 2022 at 0:44 Comment(2)
whenever I run any php artisan command, I always get that error message, so I can not execute step 2Awlwort
i added cd [your-project-name] and then composer require laravel/ui and it worked @AryabhimaA.RahmanPerilune
P
3

Had the same issue but had it working locally but not on the web host. In case you are uploading to a remote server and you can't run composer/artisan make sure to also upload the files in bootstrap/cache (packages.php and services.php)

Paniculate answered 5/10, 2022 at 13:45 Comment(0)
T
1

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

// routes/web.php
use Illuminate\Support\Facades\Route;

// ...

Auth::routes();

// ...
Tennietenniel answered 26/9, 2023 at 12:3 Comment(1)
Although I already had the laravel/ui package installed, running composer require laravel/ui upgraded the version of the package and resolved the issue for me.Distorted
M
0

you can just run composer update it worked for me

Maccarone answered 14/6 at 10:44 Comment(0)
T
0

Auth::routes() just insert authentication route to web.php, you could insert authentication route to web.php manually and do not use Auth::routes(), however for using Auth::routes() you must install laravel/ui package.

Trave answered 21/8 at 6:54 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Emery

© 2022 - 2024 — McMap. All rights reserved.