Reputation: 3903
I'm working on a local laravel-nova
project which worked fine the last couple of days. Now all of a sudden, when I try to go to the /nova
route I get a 404
error saying Page could not be found
. I tried with
php artisan config:cache
but without any luck. I even deleted the vendor
-folder and ran composer install
and php artisan nova:install
, but that didn't solve it either.
When I run php artisan route:list
I get the error:
Class App\Http\Controllers\Laravel\Nova\Http\Controllers\LoginController does not exist
What happened? How can I solve this?
My Laravel version is 5.7 and I'm running this application on a Windows 10 machine.
Upvotes: 1
Views: 9743
Reputation: 71
In file LoginController, add use App\Http\Controllers\Controller;
.
Upvotes: 0
Reputation: 3903
I found it out myself, so just in case other users may have the same problem I'm going to post an answer.
So, if you may have a route like for example:
Route::get('{subpage}', 'SubpagesController@show');
This will return the 404
and you will not be able to access Nova, e.g., the dashboard since Nova (from version 1.0.9) is always registering its routes after the application's routes.
You will have to change the config/nova.php
path to either no/va
or simply nova
by removing the /
.
See here for more.
Upvotes: 1
Reputation: 1448
Add on app/config/app.php
App\Providers\NovaServiceProvider::class,
inside 'providers'.
You may need to run these commands later if that doesn't work:
php artisan nova:publish
And
php artisan view:clear
Upvotes: 8
Reputation: 1
Try checking the nova routes are listed using the below:
php artisan route:list
Upvotes: 0
Reputation: 1
I am using Laragon.
In my case, in file config/app.php, add
App\Providers\NovaServiceProvider::class,
I then tried
php artisan nova:publish
But still a 404 error was coming, and then the following
composer dump-autoload
php artisan clear-compiled
php artisan route:clear
php artisan config:cache
It worked fine for me.
Upvotes: 0
Reputation: 2239
I battled this for a long time when I was setting up a new laptop and since it was a different answer for me I thought I would share it in case it helps anyone else.
My problem was that I copied the .env file from another computer after cloning the repo.
I spent hours battling this before I discovered that the NOVA_DOMAIN_NAME
environmental variable is critical here.
Be sure that variable matches the domain name you are using on the computer that is giving you the 404. I needed the .local
TLD and it fixed it, but you will need to use your own of course.
Upvotes: 1
Reputation: 11
This works for me, add the following code in your virtual host:
<Directory /var/www/html/checkin>
AllowOverride All
</Directory>
Upvotes: 1
Reputation: 4683
You might want to try following commands in your terminal:
composer dump-autoload
php artisan clear-compiled
php artisan route:clear
php artisan config:cache
Upvotes: 1
Reputation: 33
Verify that the App\Providers\NovaServiceProvider
was added to the providers
array in your app\config.php
configuration file. If it wasn't, you should add it manually. Of course, if your application does not use the App namespace, you should update the provider class name as needed.
Upvotes: 0