You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Laravel 7 + Vue.js 报错:View [app] not found 求助

Fixing the "View [app] not found" Error in Laravel 7 + Vue.js

Hey there, let's sort out this frustrating error you're hitting! The core issue here is pretty straightforward once you connect your code to your file structure.

Why You're Seeing This Error

In your web.php route, you're telling Laravel to load the app view:

Route::get('{any}', function () { 
    return view('app'); 
})->where('any', '.*');

But right now, the only blade view file you have in resources/views is welcome.blade.php — Laravel can't find a file named app.blade.php, hence the "View [app] not found" message.

Two Simple Fixes

You have two options to resolve this, depending on your project's needs:

Option 1: Update the Route to Use Your Existing View

If you want to keep using welcome.blade.php as your entry point, just adjust the view name in your route to match the file you already have:

Route::get('{any}', function () { 
    return view('welcome'); 
})->where('any', '.*');

This will make Laravel load your existing welcome.blade.php instead of searching for a non-existent file.

Option 2: Create the Missing app.blade.php File

Since you're using Vue.js (likely for a single-page app), it's standard practice to have a dedicated app.blade.php as your SPA entry. Here's how to set this up:

  1. In your resources/views folder, create a new file named app.blade.php
  2. Add a basic structure (you can reuse content from welcome.blade.php and tweak it for your SPA):
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Your Laravel + Vue App</title>
    <!-- Load compiled Vue assets (run npm run dev/prod first!) -->
    <link href="{{ mix('css/app.css') }}" rel="stylesheet">
</head>
<body>
    <!-- This is where your Vue app will mount -->
    <div id="app"></div>

    <script src="{{ mix('js/app.js') }}"></script>
</body>
</html>
  1. Compile your Vue assets to make sure everything loads correctly:
npm run dev

Or for production-ready assets:

npm run prod

Quick Double-Check

Make sure your view files live directly in the resources/views/ directory — Laravel doesn't look elsewhere for blade views by default. Also, note that on Linux/macOS, filenames are case-sensitive, so app.blade.php needs to be spelled exactly as you reference it in the route.

内容的提问来源于stack exchange,提问作者hari dran

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.11 07:57:17