Laravel ErrorException No such file or directory - laravel

I have uploaded my Laravel project on ubuntu server via putty terminal.
Composer installed on server machine but when i run any artisan command it gives an error.
$ php artisan serve
ErrorException
require(/var/www/html/healthapi.fynity.in/routes/api/v1/api.php): failed to open stream: No such file or directory
The api.php is already there but i don't know why this error comes. Tried all the solutions from google.

Problem:
You may have changed something earlier such as the name or the path of the file.
Solution:
First of all, you use the following command to clear all configs.
$ php artisan config:clear
Then, you run again the following command.
$ php artisan serve
Update (2021/01/07):
You got the following error:
ErrorException require(/var/www/html/healthapi.fynity.in/routes/api/v1/api.php): failed to open stream: No such file or directory at vendor/laravel/framework/src/Illuminate/Routing/RouteFileRegistrar.php:35 31
It seems that the library is not fully installed. You should update the library with the following command:
$ composer update
Then, you run again the following command:
$ php artisan serve

Related

Laravel Failed to open stream error with Sail

I'm attempting to run Sail within my Laravel project and it all starts as expected but when I go to https://localhost I get an error 500 in the browser and this error in the log
PHP Fatal error: Uncaught ErrorException: file_put_contents(/home/harry/booker/storage/framework/views/31194b376a867d7e5a56653be65b2bc7a5c4040b.php): Failed to open stream: No such file or directory in /var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:187
I know the directory /storage/framework/views exists as I can see it in my code editor. I've tried deleting my bootstrap/cache/config.php, running php artisan config:clear && php artisan config:cache but with no luck? The bootstrap config.php file has the correct reference to the views folder. I've also made sure the permissions are correct by running sudo chmod -R 755 storage/
You mention the /storage/framework/views directory exists, but does it contain the requested file 31194b376a867d7e5a56653be65b2bc7a5c4040b.php?
Also, can you try running the following in your terminal:
php artisan optimize:clear
php artisan view:cache
This should empty all Laravel caches and rebuild the views cache.

deploying laravel into Nginx getting error "failed to open stream: No such file or directory"

I have a problem with deploying laravel into my Nginx. I deployed my laravel app thru github.com
but when I execute php artisan config:cache or php artisan make:auth
This is the error I get:
PHP Warning:
require(/var/www/gafsolutions.com/html/laravel/vendor/autoload.php):
failed to open stream: No such file or directory in
/var/www/gafsolutions.com/html/laravel/artisan on line 18 PHP Fatal
error: require(): Failed opening required
'/var/www/gafsolutions.com/html/laravel/vendor/autoload.php'
(include_path='.:/usr/share/php') in
/var/www/gafsolutions.com/html/laravel/artisan on line 18
First, make sure you have set up a composer properly composer install It will just install all the dependencies as specified in the composer.lock file
If you have already installed then run this command:composer dump-autoload It will clean up all compiled files and their paths.
After, run this command: composer update --no-scripts It will Skips execution of scripts defined in composer.json file.
Then run this command: composer update It will update your depencencies as they are specified in composer.json

file_put_contents(/homepages/storage/framework/views/c8d540ced881ee3d14baa6e1259a7deab143b7fa.php): failed to open stream: No such file or directory

I have a Laravel 5 project that I copied from my friend with FTP to work on it in locally. I ran composer install to install the vendor.
The server is up, but when I enter localhost:8000, it shows me this error:
file_put_contents(/homepages/17/d595652778/htdocs/oneQ/storage/framework/views/c8d540ced881ee3d14baa6e1259a7deab143b7fa.php): failed to open stream: No such file or directory
try this code
php artisan config:cache
It hasn't worked for me:
php artisan config:cache
However this one has worked:
php artisan view:cache
in my case i try to file config.php "delete file bootstrap/cahce/config.php" and its working.
I had a similar issue and i managed to fix it by running:
composer install
from within the project directory or the container if you a using Docker-based development tool such as ddev.

Laravel Artisan not working at all after clone

I have this weird situation: I've cloned all my repositories from github in a new local machine running Mac OsX some of them has Laravel framework installed but only some of these can execute the cmd php artisan.
I've tried to check permission on folders, uninstall/re-install composer and I've also tried to install a fresh version of Laravel. Another problem is that running the command doesn't output anything - no errors, nothing - only a new empty line of the terminal.
The only thing I know is that if I clone one of the repositories, then run composer install it throws Script php artisan optimize handling the post-install-cmd event returned with error code 255.
Thanks
Update 1:
I've found running composer install -vvv -o that composer throw this error
Warning: require(/Users/USERNAME/laravel/bootstrap/autoload.php): failed to open stream: No such file or directory in /Users/USERNAME/laravel/artisan on line 16
Fatal error: require(): Failed opening required '/Users/USERNAME/laravel/bootstrap/autoload.php' (include_path='.:') in /Users/USERNAME/laravel/artisan on line 16
Update 2:
It seems that cmd git clone didn't copy that autoload file bootstrap/autoload.php for some reason that I don't understand at all.
I've imported the file manually from github and run, removed the vendor folder then run again composer install --no-scripts but still having the problem with artisan and if I run composer update it throw Script php artisan optimize handling the post-update-cmd event returned with error code 255
I had to re-install laravel and copy files manually to make it works again.

laravel cache failed to open stream: No such file or directory framework/views

I use laravel 5.4. a clear cache after update config file. that appear like this error.
ErrorException in Filesystem.php line 111:
file_put_contents(/home/web_user/webhosts/mufer/backend.mufer.local/storage/framework/views/318a49f22562be3fc1c86c88ecc141c22e`8fed4e.php): failed to open stream: No such file or directory`
Then i try to fixed using following command:
php artisan route:cache
php artisan view:clear
php artisan config:cache
and:
file_put_content...fail to open stream:Permission denied in Laravel 5
Some answer are said craete /storage/framework sub folders and then composer update. but that also not working.
screen shot
Then i run composer dump-autoload
andcomposer update`.
But problem not solved..
Perhaps you are using Homestead?
I ran into this problem when using Homestead. Basically, when you are using Homestead and run the php artisan config:cache command out of your virtual machine, the cache paths get broken.
I solved it login via ssh to Homestead vagrant ssh and running php artisan config:cache from there.
My solution was to chmod /storage/framework/views directory to 777.
I had this same problem and my mistake was so simple it's hilarious.
I forgot to git add one of my files. So on the backend, it was trying to get this file.php but it didn't exist. It's usually quite descriptive in the error, except, I was running a job that jumps on a queue. All of a sudden, that helpful exception no longer exists :D
So in order to fix it, I had to:
git add -A
git commit -m "blah blah"
git push
On the server, I needed to:
git pull
composer dump-autoload
It's worked for me gently:
php artisan view:cache

Resources