Class 'Illuminate\Foundation\Application' not found in laravel 5.4 - laravel

I was create latest laravel project using
composer create-project --prefer-dist laravel/laravel test
After when i run php artisan serv then give me error like:
failed to open stream: No such file or directory in
/var/www/html/test/bootstrap/autoload.php on line 17
After i was run composer dumpauto and solved my problem and after i run php artisan serv then still get error as:
Class 'Illuminate\Foundation\Application' not found in
/var/www/html/sample-project/bootstrap/app.php on line 14
Please help me and solve my issue
Thanks in advance

You should try this:
Please run below command:
composer install --no-scripts

In my case it worked removing "vendor" folder and "composer.lock" and then run:
composer install

Watch step wise step in video tutorial for your problem
Expert Suggestion
then after delete your vendor folder and then hit compser install

Related

How to solve php artisan key generate error?

I created a new Laravel 5.5 project with this command:
laravel new crud-angular
After then, run this command inside the project folder:
php artisan key:generate
At that moment, I got such error:
Warning: require(F:\Study\Laravel\crud-angular/vendor/autoload.php):
failed to open stream: No such file or directory in
F:\Study\Laravel\crud-angular\artisan on line 18
Fatal error: require(): Failed opening required
'F:\Study\Laravel\crud-angular/vendor/autoload.php'
(include_path='.;C:\php\pear') in
F:\Study\Laravel\crud-angular\artisan on line 18
I used wampserver 3.0.6 for this project.
Hope to help me.
Thanks
Make sure you have run:
composer install
Now it seems packages are not installed. If they are, try running:
composer dump-autoload
Try to to give permission for that vendor folder
sudo chmod -R 777 vendor
update your composer also
composer update
this will fix your issue
Most likely you forgot to Install composer just run composer install

Laravel 5.5 install not generating .env file

I have installed laravel 5.4 multiple times.
Now I'm trying to install laravel 5.5 using same command And it doesn't work.
composer create-project --prefer-dist laravel/laravel blog dev-develop
It doesn't seem to have any errors on installation, only lot of suggestions.
But no key is generated and no .env file is created.
When I try to make php artisan key:generate
/public_html/blog/.env): failed to open stream: No such file or directory
Got the same problem days a go, the problem was because composer was not updated, solved it updating composer, you can run:
composer self-update
Or you can download the latest version there, then you can create the project again and the .env file will be automatically created.
I have this version
Composer version #package_branch_alias_version# (1.0.0-beta2) 2016-03-27 16:00:34
When I run composer self-update I get
[InvalidArgumentException]
Command "self-update" is not defined.
shell command: cp .env.example .env
If you just want to make current setup work, just try doing the following:
cp .env.example .env
php artisan key:generate
But as suggested by one of the answers here, you should update your composer if you have an old version. To check your installed version, do so with composer -v
This is happening because of your Laravel Installer or Composer version. I have faced the same problem and found following 2 different solutions:
Generally, you can solve with by running composer global update command and then run composer update command from your project directory. This solution basically updates your installer and then your project.
If still, you have this problem, then you need to run composer self-update command first and then run composer update command from your project directory. It will update your composer version and then your project.
Hope this information will help you to fix.

how to make php artisan command available?

I read previous posts here about same problem but they did not solve my problem. I am running wamp latest version on windows 7 and I cloned a laravel app from github then I ran composer install on the root folder of the app and all vendors installed. however I still can not execute php artisan list on the app root folder
I tried also this command
composer global require "laravel/installer=~1.1"
but same problem also there is no laravel folder installed inside vendor folder. I dont know what laravel version used with this web app
So how I can make php artisan work ?
Update:
I opened composer.json file and I found no Laravel frame work to install !! should I return to the developer who made this or I just add Laravel package to composer.json and run composer install again ? if so what I should add to the composer.json ? I dont know which version to install !!
Your project has to have an artisan file in the root directory, otherwise the php artisan command won't work.
I had a similar issue. Fixed it by using the following command, which results in a clean installation.
composer create-project --prefer-dist laravel/laravel my-project
If errors occur, your CLI will show them.
Docs

Laravel 5.2 - Installing intervation image error command

i'm tryng to install intervation image in my laravel project 5.2, i'm tryng install by composer like this:
$ php composer.phar require intervention/image
but composer give me an error like the image:
i don't know why, there other way to install it? or fix this issue?
thank you for your support!
Step 1
First type composer in you command prompt, check if composer is installed or not. you should see something like that.
If this is there then composer is installed goto Step 2 , otherwise install the composer from here
Step 2
For intervention image
go to your root directory of laravel project
run command composer require intervention/image
It will download the latest version of composer
after installing go to your config/app.php
in provider array add
Intervention\Image\ImageServiceProvider::class
in alias array add
'Image' => Intervention\Image\Facades\Image::class
after installing run command php artisan config:publish
it will copy the intervention config file to your config directory.
Hope this will help.
No need of adding $ at the beginning.
Just use:
php composer.phar require intervention/image
$ in documentation indicates that the command is to be run in a terminal ( usually Linux ).
Add this line to your composer.json, then run composer update.
"intervention/image": "2.*"

artisan or composer commands - php fatal error

I made one change in my composer.json including Facebook SDK package (http://packagist.org/packages/facebook/php-sdk).
So during the composer update I got this error
$ php artisan optimize
PHP Fatal error: Interface 'SessionHandlerInterface' not found in
/Users/Leandro/www/bootstrap/compiled.php on line 2644
After this, I can't run artisan or composer commands. Always get the same error.
I tried to remove Facebook SDK from composer json but not works.
Some help? Using --no-scripts the command works fine:
composer update --no-scripts
try to do this :
composer dump-autload
composer update
i think this may or may not solve it for you ..
you may need to delete the .json file which can be found on app\storage\meta, not 100% sure but it might work ..
Check out this troubleshooting checklist, sounds like you need to do a php artisan dump-autoload though.

Resources