Reputation: 11
In the new Laravel 9 project, after installing the UI, I have a problem with the php artisan route:cache command. Message appears:
Unable to prepare route [password/reset] for serialization. Another route has already been assigned name [password.request]. Checking route:list, no duplicate route.
Everything is fine on the local server, but some routes are not working on the hosting.
Upvotes: 1
Views: 233
Reputation: 8410
First find the details of the duplicates
php artisan route:list --name=password.request
For me this showed
+--------+----------+-----------------+------------------+------------------------------------------------------------------------+-------------------------------------------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+----------+-----------------+------------------+------------------------------------------------------------------------+-------------------------------------------------+
| | GET|HEAD | forgot-password | password.request | Laravel\Fortify\Http\Controllers\PasswordResetLinkController@create | web |
| | | | | | App\Http\Middleware\RedirectIfAuthenticated:web |
| | GET|HEAD | password/reset | password.request | App\Http\Controllers\Auth\ForgotPasswordController@showLinkRequestForm | web |
| | | | | | App\Http\Middleware\Cors |
+--------+----------+-----------------+------------------+------------------------------------------------------------------------+-------------------------------------------------+
Which led to the routes/web.php
file that had the default
Auth::routes();
removing this line (I knew the alternate authorisation package was in place) and re-running
php artisan route:cache
fixed the conflict.
Upvotes: 0
Reputation: 46
Are the names of those route not the same?
By the name I mean the "name" method as follow bellow:
Route::get('/user', [UserController::class, 'index'])->name('thisMustBeAnUniqueName);
Upvotes: 0