Laravel Nova, route not found
Asked Answered
B

10

10

I've installed Laravel Nova (using Laravel 5.6). App\Providers\NovaServiceProvider::class is registered in my config/app.php file. But when I go to https://localhost:1234/nova I get a 404 error.

I have cleared my caches and run a composer dump-autoload. How can I get this route working?

EDIT: When I run php artisan route:list the nova-api routes are there but there is no route for nova.

Also, the migrations were not copied across after nova:install. I am working with an existing Laravel project.

Bula answered 24/8, 2018 at 13:5 Comment(9)
Did you run php artisan nova:install?Zadazadack
@ChinLeung Yes - that's how I got App\Providers\NovaServiceProvider::class in the config/app.php file.Bula
as you told nova works only for api requests not in browser right?Seclude
this is a test version of this nova dashboard which i would never pay money for it.Axle
Do you have the file config/nova.php?Zadazadack
@ChinLeung Yes.Bula
@ChinLeung If it makes a difference, I am using Passport in the app.Bula
Hmm.. Are you caching your config by any chance? Did you try php artisan config:clear?Zadazadack
@ChinLeung You are right! Please write it as an answer & I will mark it correct.Bula
Z
3

You have to clear the config cache for the changes to actually apply:

php artisan config:clear
Zadazadack answered 24/8, 2018 at 14:38 Comment(0)
T
13

Verify App\Providers\NovaServiceProvider is in your provider list.

  • Go to config/app.php
  • Add App\Providers\NovaServiceProvider::class, to the providers

Note that this answer is relative to @jszobody's anwser and a direct answer to a question following up upon that aforementioned tweet. https://twitter.com/taylorotwell/status/1032300773655408640

Without this, it is possible to see the Nova panel, though it remains empty. A fresh install at this time will show a "Help" Card on the Dashboard.

Think answered 11/9, 2018 at 22:15 Comment(0)
R
5

I ran into this problem too. Add Nova::routes(); to your routes/web.php and reload /nova in your browser.

Rico answered 24/8, 2018 at 13:32 Comment(2)
Some progress. Now I get Trying to get property of non-object (View: /app/resources/views/vendor/nova/partials/user.blade.php).Bula
Are you authenticated ? This partial is trying to get email and name from the authenticated user.Heartwhole
Z
3

You have to clear the config cache for the changes to actually apply:

php artisan config:clear
Zadazadack answered 24/8, 2018 at 14:38 Comment(0)
T
1

If you have disabled Package Discovery / Autodiscover by adjusting your composer.json like so:

"extra": {
    "laravel": {
        "dont-discover": [
            "*"
        ]
    }
}

You need to add the the NovaCoreServiceProvider and Nova alias to your config/app.php manually.

'providers' => [
    Laravel\Nova\NovaCoreServiceProvider::class,
],
'aliases' => [
    'Nova' => Laravel\Nova\Nova::class,
]

If you look at the composer.json of laravel/nova in your vendor folder you can see this:

"extra": {
    "laravel": {
        "providers": [
            "Laravel\\Nova\\NovaCoreServiceProvider"
        ],
        "aliases": {
            "Nova": "Laravel\\Nova\\Nova"
        }
    }
},
Tanta answered 9/7, 2019 at 12:46 Comment(0)
D
0

From Taylor (if you are using an earlier version than Nova 1.0.1):

If you are having issues with Nova not registering a /nova route when using "php artisan serve"... try upgrading Nova and updating your route registration in your NovaServiceProvider to match this image... (add "register" on end of chain).

enter image description here

https://twitter.com/taylorotwell/status/1032298042773393408

Divider answered 24/8, 2018 at 13:34 Comment(0)
S
0

I had the same issue. Resolved by finally remember to enable HTTP rewrite.

a2enmod rewrite

then restart apache

sudo systemctl restart apache2
Sansculotte answered 11/10, 2019 at 13:49 Comment(0)
A
0

check if the route does not require an id

for example /student/:id

Adulate answered 20/9, 2020 at 17:43 Comment(1)
More of a comment than an answerVasiliki
C
0

I realize it has been some time since this was posted, and there are other answers, but today I encountered the same problem a fresh install seemingly out of nowhere and resolved it by adding

\Laravel\Nova\NovaCoreServiceProvider::class to the providers array in config/app.php.

After doing so, I ran artisan route:clear to clear and rebuild the route cache, and the problem was resolved.

I have no idea what could have caused this issue, as I've bootstrapped multiple new laravel projects with nova the exact same way and never encountered this issue.

Clarkin answered 22/2, 2022 at 22:36 Comment(0)
P
0

One option is to debug to check all Nova routes. Add the lines above in the NovaServiceProvider class boot() function.

    public function boot()
    {
        parent::boot();
        Nova::serving(function (ServingNova $event) {
            $request = $event->request;
            \Log::debug(Nova::resourceInformation($request));
        }
Patterman answered 3/5, 2022 at 18:1 Comment(0)
Y
0

Simply if none of solutions works delete vendor file and try again

Yacketyyak answered 22/10, 2023 at 18:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.