Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Shubbi's avatar

View not found on Forge

Hi all,

I've just deployed my first app to Laravel Forge and now I'm getting the error "View [web.index] not found". I've checked the the view is properly placed in /resources/views/web/index.blade.php and I don't know what more to check. Have anyone got this kind of message before? Do I need to run som certain commands in Forge to make things work?

Tech stack: Laravel, InertiaJS + ReactJS.

[2022-07-19 09:00:23] 
production.ERROR: View [web.index] not found. {"exception":"[object] (InvalidArgumentException(code: 0): View [web.index] not found. at /home/forge/SITE_NAME/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php:137)
[stacktrace]
#0 /home/forge/SITE_NAME/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php(79): Illuminate\View\FileViewFinder->findInPaths()
#1 /home/forge/SITE_NAME/vendor/laravel/framework/src/Illuminate/View/Factory.php(137): Illuminate\View\FileViewFinder->find()
#2 /home/forge/SITE_NAME/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(948): Illuminate\View\Factory->make()
#3 /home/forge/SITE_NAME/routes/web.php(78): view()
#4 /home/forge/SITE_NAME/vendor/laravel/framework/src/Illuminate/Routing/Route.php(237): Illuminate\Routing\RouteFileRegistrar->{closure}()
#5 /home/forge/SITE_NAME/vendor/laravel/framework/src/Illuminate/Routing/Route.php(207): Illuminate\Routing\Route->runCallable()
#6 /home/forge/SITE_NAME/vendor/laravel/framework/src/Illuminate/Routing/Router.php(725): Illuminate\Routing\Route->run()
#7 /home/forge/SITE_NAME/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#8 /home/forge/SITE_NAME/vendor/inertiajs/inertia-laravel/src/Middleware.php(88): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#9 /home/forge/SITE_NAME/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Inertia\Middleware->handle()
#10 /home/forge/SITE_NAME/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(50): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#11 /home/forge/SITE_NAME/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Routing\Middleware\SubstituteBindings->handle()
#12 /home/forge/SITE_NAME/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#13 /home/forge/SITE_NAME/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle()
#14 /home/forge/SITE_NAME/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#15 /home/forge/SITE_NAME/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\View\Middleware\ShareErrorsFromSession->handle()
....
0 likes
9 replies
Sinnbeck's avatar

Try clearing cache php artisan optimize:clear

Shubbi's avatar

Thanks for the quick reply @sinnbeck, but I'm afraid it did not help. The index.blade.php does extends @extends('web') and even that is placed in /resources/views/web.blade.php.

The site is working locally, so it shouldn't be a code error.

Sinnbeck's avatar

@ShadiDomat check the casing. If you are developing on windows or Mac, then 'index' and 'Index' is the same, while on Linux they are not (Linux is case sensitive)

Shubbi's avatar

@Sinnbeck I'm using Mac for development and hosting on AWS Lightsale - Ubunto. Everything is lower case as I see it.

My web.php:

Route::get('/', function () {
    return view('web/index');
})->name('start');

My index blade views/web/index.blade.php:

@extends('web')

@section('head')
HEAD
@endsection

@section('content')
CONTENT
@endsection

My web blade views/web.blade.php:

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">

<head>
    <title>TITLE</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
    <link href="{{ mix('/css/web.css') }}" rel="stylesheet" media="all" />
    <style>
      .gradient {
        background: linear-gradient(90deg, #8E2DE2 0%, #4A00E0 100%);
      }
    </style>
    @yield('head')  
</head>
<body class="leading-normal tracking-normal text-white gradient">
    <x-nav />
    @yield('content')  
    <x-footer />
</body>
</html>
Shubbi's avatar

@Sinnbeck I'm not sure about how Ubunto works, but could there be a "clash" between a folder called web and a file alled web.blade.php in the same root? 🤔

views/web/index.blade.php
views/web.blade.php 
Sinnbeck's avatar

@ShadiDomat I was thinking the same thing, but I honestly haven't tested it myself (I use Ubuntu for development). I don't think it would be an issue, but currently I can't think of anything else

Shubbi's avatar

@Sinnbeck I've changed the file name to web-layout.blade.php and the problem is still the same. Frustrating, but I'm sure it's an easy fix.

Sinnbeck's avatar

@ShadiDomat try using dot notation. And you can simplify this as well

Route::view('/', 'web.index')->name('start');
Shubbi's avatar

Thanks for all the help. The fix was quite easy, but hard to detect ("hidden").

It was a Visual Code issue where the "W" in "web" was uppercased in finder, but Visual Code displayed it as lowercased.

Please or to participate in this conversation.