Laravel Nova,未找到路线

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/52005167/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 18:00:15  来源:igfitidea点击:

Laravel Nova, route not found

phplaravellaravel-nova

提问by GluePear

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

我已经安装了 Laravel Nova(使用 Laravel 5.6)。App\Providers\NovaServiceProvider::class已在我的config/app.php档案中注册。但是当我去https://localhost:1234/nova我得到一个404错误。

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

我已经清除了缓存并运行了composer dump-autoload. 我怎样才能让这条路线工作?

EDIT: When I run php artisan route:listthe nova-apiroutes are there but there is no route for nova.

编辑:当我运行路线时php artisan route:listnova-api路线在那里,但没有路线nova

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

此外,在nova:install. 我正在使用现有的 Laravel 项目。

采纳答案by Chin Leung

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

您必须清除配置缓存才能实际应用更改:

php artisan config:clear

回答by Ken Verhaegen

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

验证 App\Providers\NovaServiceProvider 在您的提供商列表中。

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

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

请注意,此答案与@jszobody 的 anwser 相关,并且是对上述推文的后续问题的直接答案。 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.

没有这个,可以看到 Nova 面板,尽管它仍然是空的。此时全新安装将在仪表板上显示“帮助”卡。

回答by Andrew

I ran into this problem too. Add Nova::routes();to your routes/web.phpand reload /novain your browser.

我也遇到了这个问题。添加Nova::routes();到您的浏览器routes/web.php并重新加载/nova

回答by jszobody

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

来自 Taylor(如果您使用的是 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).

如果您在使用“php artisan serve”时遇到 Nova 未注册 /nova 路由的问题...尝试升级 Nova 并更新您在 NovaServiceProvider 中的路由注册以匹配此图像...(在链的末尾添加“注册” )。

enter image description here

在此处输入图片说明

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

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

回答by Dani?l de Wit

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

如果您通过像这样调整 composer.json禁用了包发现/自动发现

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

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

您需要config/app.php手动添加 NovaCoreServiceProvider 和 Nova 别名。

'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:

如果您查看供应商文件夹中 laravel/nova 的 composer.json,您可以看到:

"extra": {
    "laravel": {
        "providers": [
            "Laravel\Nova\NovaCoreServiceProvider"
        ],
        "aliases": {
            "Nova": "Laravel\Nova\Nova"
        }
    }
},

回答by JAGOS

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

我遇到过同样的问题。解决了最后记得启用HTTP重写。

a2enmod rewrite

then restart apache

然后重启apache

sudo systemctl restart apache2