I am currently trying to run on Vagrant/Homestead a Laravel Application that I pulled from Github. I connected it to the database, and run Composer Install, Composer Update inside the folder. When I try to access to it on the Browser I get the following error:
Warning: require(/home/vagrant/.../public/vendor/autoload.php): failed to open stream: No such file or directory in /home/vagrant/..../public/autoload.php on line 2
I navigated to the vendor folder and noticed that it was not created. Any ideas how to fix it?
The application runs in Laravel 4, and I got the following output from the terminal when I run Composer Install:
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Package herrera-io/json is abandoned, you should avoid using it. Use kherge/json instead.
Package kherge/version is abandoned, you should avoid using it. No replacement was suggested.
Package herrera-io/phar-update is abandoned, you should avoid using it. No replacement was suggested.
Package mjolnic/bootstrap-colorpicker is abandoned, you should avoid using it. Use itsjavi/bootstrap-colorpicker instead.
Generating autoload files
php artisan clear-compiled
php artisan optimize
Generating optimized class loader
Any ideas?
Composer needs to be run from the root of your application, i.e. not from the public folder as your error seems to indicate.
You can first try running:
composer install --no-scripts
This command should list the packages that are being downloaded and installed. If the above works, you can then run:
php artisan optimize
This will create the autoload.php file that Laravel will use.
I also experienced that, i solved the problem by creating a vendor/bin folder inside the Composer directory.
$PATH/users/*-system_name-*/AppData/Roaming/Composer
I got the same problem, some answer are valid but didnt help then i tried a command = composer dump-autoload. Then it works fine. HOPE this helps you the best.
I'm trying to use the following library, this.
It all seems pretty use but doesn't seem to work for me. I've added the stuff the the composer.json and I also updated the app.php. Then I ran composer dump-autoload in the laravel directory.
I still seem to be getting the same error..
FatalErrorException in ProviderRepository.php line 146:
Class 'Invisnik\LaravelSteamAuth\SteamServiceProvider' not found
Try to install this package by this command:
composer require invisnik/laravel-steam-auth
You will install the latest version of current package and update your composer.json, composer.lock and autoload files.
When I run composer update, I get the following error:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
Illuminate\Foundation\ComposerScripts::postUpdate
php artisan optimize
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Laravel\Cashier\CashierServiceProvider' not found
Script php artisan optimize handling the post-update-cmd event returned with err
or code 255
I put this code on the app.php file
Laravel\Cashier\CashierServiceProvider::class,
and in the composer.json I also put this
"laravel/cashier": "~6.0"
like in the laravel doc
stack errot
Remove the
Laravel\Cashier\CashierServiceProvider::class,
from app.php.
It needs to be added after installing the package.
Also, instead of composer update, try composer require without changing the composer.json file.
composer require laravel/cashier
Don't add anything in composer.json file or app.php.
Just follow the documentation given in Laravel website for Laravel Cashier, (select the laravel version which you are using in your project).
Run the commands in following order:
//install the package and add it in composer file
composer require laravel/cashier
//add your cashier class in 'providers' array in app.php
Laravel\Cashier\CashierServiceProvider::class,
//add alias in 'aliases' array in app.php
'Cashier' => Laravel\Cashier\CashierServiceProvider::class,
//will add several columns to users table & create a new subscriptions table
php artisan migrate
Check the php version in cmd useing php -v
if php version is < 7.0 then install latest version of php.
Uninstall the old verion Xampp
Install latest version of Xampp to upgrade php.
I installed emanuelzh/loptimizer for Laravel 5 (on Ubuntu). It is a fork from https://github.com/approached/laravel-image-optimizer
It is for image optimization.
I successfully installed it with composer:
composer.phar require emanuelzh/loptimizer
Using version ^1.0 for emanuelzh/loptimizer ./composer.json has been
updated php artisan clear-compiled Loading composer repositories with
package information Updating dependencies (including require-dev)
- Installing emanuelzh/loptimizer (1.0.0) Downloading: 100% Writing lock file Generating autoload files php artisan optimize
Generating optimized class loader
But the problem is with config/app.php file. I added the following line but it doesn't work when I try to publish.
config/app.php:
Emanuelzh\Loptimizer\ServiceProvider::class,
Publish command:
php artisan vendor:publish
Result of publish command:
Nothing to publish for tag [].
Do you know what is the correct line to add in config/app.php ?
Thanks for your help.
Remy
Ok. Finally I found the answer :)
The line to add in config/app.php is:
Approached\LaravelImageOptimizer\ServiceProvider::class,
and for the facade:
'ImageOptimizer' => Approached\LaravelImageOptimizer\ImageOptimizer::class,
Hope it helps!
I am getting following error when I open my site which is made using laravel 5
Fatal error: Class 'Illuminate\Foundation\Application' not found in C:\cms\bootstrap\app.php on line 14
I have tried removing vendor folder and composer.lock file and running composer install it's not working I tried running PHP artisan optimize but it shows error
Fatal error: Class'Illuminate\Foundation\Application' not found
Is there any way to solve this problem?
Edited:
This problem aroused as soon as I used the php artisan make:model Page command which did create the model but then the above error gets displayed when I access the site
Also If use the Laravel's Local Development Server no such problem arises only if I use wamp server
In my situation, I didn't have the full vendor dependencies in place (composer file was messed up during original install) - so running any artisan commands caused a failure.
I was able to use the --no-scripts flag to prevent artisan from executing before it was included. Once my dependencies were in place, everything worked as expected.
composer update --no-scripts
Just in case I trip over this error in 2 weeks again...
My case: Checkout an existing project via git and pull in all dependencies via composer. Came down to the same error listed within the title of this post.
Solution:
composer dump-autoload
composer install --no-scripts
make sure everything works now as expected (no errors!)
composer update
Something is clearly corrupt in your Laravel setup and it is very hard to track without more info about your environment. Usually these 2 commands help you resolve such issues
php artisan clear-compiled
composer dump-autoload
If nothing else helps then I recommend you to install fresh Laravel 5 app and copy your application logic over, it should take around 15 min or so.
Easy as this, that worked for my project
Delete /vendor folder
and execute composer install
then run project php artisan serve
In my case composer was not installed in that directory. So I run
composer install
then error resolved.
or you can try
composer update --no-scripts
cd bootstrap/cache/->rm -rf *.php
composer dump-autoload
I just fixed this problem (Different Case with same error),
The answer above I tried may not work because My case were different but produced the same error.
I think my vendor libraries were jumbled,
I get this error by:
1. Pull from remote git, master branch is codeigniter then I do composer update on master branch, I wanted to work on laravel branch then I checkout and do composer update so I get the error,
Fatal error: Class 'Illuminate\Foundation\Application' not found in
C:\cms\bootstrap\app.php on line 14
Solution:
I delete the project on local and do a clone again, after that I checkout to my laravel file work's branch and do composer update then it is fixed.
I had accidentally commented out:
require __DIR__.'/../bootstrap/autoload.php';
in
/public/index.php
When pasting in some debugging statements.
For latest laravel version also check your version because I was also
facing this error but after update latest php version, I got rid from
this error.
run composer require laravel/framework after composer install then php artisan key:generate its work for me in kali linux
I can't imagine that anyone else reading this is a stupid as I was but just in case...
I had accidentally removed "laravel/framework": "^5.6" from my composer.json when resolving merge conflicts.
please test below solution:
first open command prompt cmd ==> window+r and go to the location where laravel installed.
try composer require laravel/laravel
i was having same problem with this error.
It turn out my Kenel.php is having a wrong syntax when i try to comply with wrong php8 syntax
The line should be
protected $commands = [
//
];
instead of
protected array $commands = [
//
];
#kalhan-toress 's comment is what ACTUALLY WORKED FOR ME
remove /bootstrap/start.php,composer.lock, and the vendor and run composer install
In my case, the error was caused on initial deployment because I didn't have a .env file in that directory (because those don't belong on Github where the files were transferred from).
check your .env file i think you miss something. Maybe like this
if yes then need to add manually and composer update or install composer