too*_*nin 5 laravel fortify laravel-mix laravel-8 laravel-jetstream
我过去能够成功部署 Laravel 项目。我第一次将 Laravel 8 与 Jetstream 和 Livewire 一起使用。Laravel 现在使用 Fortify 进行登录和注册身份验证。
我的本地服务器运行完美,没有任何问题。将项目部署到 Hostgator 共享托管帐户后,我的主页正确加载,并正确从数据库读取和输出数据。
但是,当我尝试访问时
mydomain.com/login/ 或 mydomain.com/login 或 mydomain.com/register/ 或 mydomain.com/register
我收到 500 错误。在这个问题的末尾,我粘贴了错误日志。
我做了以下事情:
我觉得很奇怪,我的主页加载完美,并且从数据库中获取数据也很好,因此我知道我的 .env 文件具有正确的数据库连接凭据。只有登录和注册才会抛出500错误。
我的环境文件:
APP_NAME=NameOfApp
APP_ENV=production
APP_KEY=base64:KeyGeneratedWhenProjectCreated
APP_DEBUG=false
APP_URL=http://domain
LOG_CHANNEL=stack
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=db_works_good
DB_USERNAME=username_works_good
DB_PASSWORD=passwordWorksGood
Run Code Online (Sandbox Code Playgroud)
这是 laravel.log (缩写为看起来重要的内容):
[2020-11-30 20:25:34] production.ERROR: The Mix manifest does not exist. (View: /domain_root_path/app/resources/views/layouts/guest.blade.php) (View: /domain_root_path/app/resources/views/layouts/guest.blade.php) {"exception":"[object] (ErrorException(code: 0): The Mix manifest does not exist. (View: /domain_root_path/app/resources/views/layouts/guest.blade.php) (View: /domain_root_path/app/resources/views/layouts/guest.blade.php) at /domain_root_path/app/vendor/laravel/framework/src/Illuminate/Foundation/Mix.php:46)
[stacktrace]
#0 /domain_root_path/app/vendor/livewire/livewire/src/CompilerEngine.php(38): Illuminate\\View\\Engines\\CompilerEngine->handleViewException(Object(ErrorException), 0)
#1 /domain_root_path/app/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(60): Livewire\\CompilerEngine->handleViewException(Object(ErrorException), 0)
#2 /domain_root_path/app/vendor/livewire/livewire/src/LivewireViewCompilerEngine.php(32): Illuminate\\View\\Engines\\PhpEngine->evaluatePath('/home2/usr2...', Array)
...................
#52 /domain_root_path/public_html/index.php(52): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#53 {main}
[previous exception] [object] (Exception(code: 0): The Mix manifest does not exist. at /domain_root_path/app/vendor/laravel/framework/src/Illuminate/Foundation/Mix.php:46)
[stacktrace]
#0 /domain_root_path/app/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(506): Illuminate\\Foundation\\Mix->__invoke('/css/app.css')
#1 /domain_root_path/app/storage/framework/views/f25b68bee7f180a7da8624828693071be98325dc.php(14): mix('css/app.css')
#2 /domain_root_path/app/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(107): require('/home2/usr2...')
............................................
#66 {main}
Run Code Online (Sandbox Code Playgroud)
文件结构:
root 有两个文件夹:
我的index.php(公共内部)具有以下路径:
require __DIR__.'/../app/vendor/autoload.php';
$app = require_once __DIR__.'/../app/bootstrap/app.php';
Run Code Online (Sandbox Code Playgroud)
GUEST.BLADE.PHP 看起来像这样:(请注意,这个文件是 Laravel 自动生成的,我没有碰过它)
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title>
<!-- Fonts -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap">
<!-- Styles -->
<link rel="stylesheet" href="{{ mix('css/app.css') }}">
<!-- Scripts -->
<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.7.3/dist/alpine.js" defer></script>
</head>
<body>
<div class="font-sans text-gray-900 antialiased">
{{ $slot }}
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
/public/mix-manifest.json:
{
"/js/app.js": "/js/app.js",
"/css/app.css": "/css/app.css"
}
Run Code Online (Sandbox Code Playgroud)
我更换了
<link rel="stylesheet" href="{{ mix('css/app.css') }}">
和
<link rel="stylesheet" href="/css/app.css/">
现在可以了。
| 归档时间: |
|
| 查看次数: |
11732 次 |
| 最近记录: |