File view welcome does not exist in Laravel 5.3

Posted on

In this article, it will be discussed further when an error is generated not only by the laravel.log file but also in the default page shown in Laravel 5.3 based web application framework. Below is the content of the laravel.log file describing the errors :

[2017-02-12 15:42:28] local.ERROR: InvalidArgumentException: View [welcome] not found. in /var/www/html/laravel-project/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php:137
Stack trace:
#0 /var/www/html/infrastructure/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php(79): Illuminate\View\FileViewFinder->findInPaths('welcome', Array)
#1 /var/www/html/laravel-project/vendor/laravel/framework/src/Illuminate/View/Factory.php(174): Illuminate\View\FileViewFinder->find('welcome')
#2 /var/www/html/laravel-project/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(855): Illuminate\View\Factory->make('welcome', Array, Array)
#3 /var/www/html/laravel-project/routes/web.php(16): view('welcome')

Below is also the image of the error described :

File view welcome does not exist in Laravel 5.3
File view welcome does not exist in Laravel 5.3

Related to the error produced in laravel.log file which is usually stored in  storage/logs/laravel.log folder and it is part of the application based on Laravel 5.3 framework, usually there is a cause normally triggered this thing.

That is because there is no file named ‘welcome.blade.php’ in the resource/views. It is because in the default root file specified, the first file which is being searched to be executed is a file named ‘welcome.blade.php’ as shown in the web.php file below :

 <?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/


Route::get('/', function () {
    return view('welcome');
});

The web.php file can be found in the default location routes folder in Laravel 5.3. So, the default file location is in routes/web.php. The ‘welcome.blade.php’ file which is trying to be searched carefully in the view file location, normally exists in resources/views/ is not available.

Try to search it as follows :

user@hostname:/var/www/html/laravel-project/resources/views$ ls -al
user@hostname:/var/www/html/laravel-project/resources/views$

So, in order to fix the problem, the first thing to do is to create a file named welcome.blade.php. But, it is normally exist when the first step for creating the laravel-based website application in any version of Laravel has already been successfully carried out. Below is how to create a file named ‘welcome.blade.php’ :

user@hostname:/var/www/html/laravel-project/resources/views$ touch welcome.blade.php
user@hostname:/var/www/html/laravel-project/resources/views$
-rw-rw-r-- 1 user user 2561 Sep 20 20:38 welcome.blade.php

Below is the content of the ‘welcome.blade.php’ which is normally exist in the initial process of creating Laravel-based web application project :

Or simply just add the following content :

==================================================

Laravel

<!– Fonts –>
<!– Styles –>
<style>
html, body {
background-color: #fff;
color: #636b6f;
font-family: ‘Raleway’, sans-serif;
font-weight: 100;
height: 100vh;
margin: 0;
}

.full-height {
height: 100vh;
}

.flex-center {
align-items: center;
display: flex;
justify-content: center;
}

.position-ref {
position: relative;
}

.top-right {
position: absolute;
right: 10px;
top: 18px;
}

.content {
text-align: center;
}

.title {
font-size: 84px;
}

.links > a {
color: #636b6f;
padding: 0 25px;
font-size: 12px;
font-weight: 600;
letter-spacing: .1rem;
text-decoration: none;
text-transform: uppercase;
}

.m-b-md {
margin-bottom: 30px;
}
</style></pre>
<div class=”flex-center position-ref full-height”>
@if (Route::has(‘login’))
<div class=”top-right links”>
<a href=”{{ url(‘/login’) }}”>Login</a>
<a href=”{{ url(‘/register’) }}”>Register</a></div>
@endif
<div class=”content”>
&nbsp;
<div class=”title m-b-md”>Laravel</div>
&nbsp;
<div class=”links”>
<a href=”https://laravel.com/docs”>Documentation</a>
<a href=”https://laracasts.com”>Laracasts</a>
<a href=”https://laravel-news.com”>News</a>
<a href=”https://forge.laravel.com”>Forge</a>
<a href=”https://github.com/laravel/laravel”>GitHub</a>

</div>
&nbsp;
</div>
&nbsp;
</div>
&nbsp;

============================================================

This is the image of Laravel 5.3 ‘s default page  based on the content above :

File view welcome does not exist in Laravel 5.3
File view welcome does not exist in Laravel 5.3

Another simple content which can be used to test the file as shown as follows :

===========================================

<h1>Hello World, Laravel !</h1>

===========================================

The image of the above content can be shown below :

File view welcome does not exist in Laravel 5.3
File view welcome does not exist in Laravel 5.3

The content of the file named ‘welcome.blade.php’ can be filled with any content. In the same logical thinking, the web.php file can also be modified into any file named such as ‘test.blade.php’, ‘default.blade.php’ as long as the file have the file format of ‘blade.php’.

One thought on “File view welcome does not exist in Laravel 5.3

Leave a Reply