Class 'Illuminate\Cache\CacheServiceProvider' not found - php

I'm working on a laravel project with my android phone.
I cleared junk files on the phone using a software and now I get error when trying to serve the laravel project.
First, I ran php artisan serve and got this error:
$ php artisan serve
In PackageManifest.php line 168:
The /storage/emulated/0/web/tbcians/bootstrap
/cache directory must be present and writable
.
Then I created the cache directory and ran php artisan serve again and got another error:
$ php artisan serve
In ProviderRepository.php line 208:
Class 'Illuminate\Cache\CacheServiceProvider'
not found
How do I fix this?
I've tried running
$ composer update
and
$ composer update --no-scripts
but I'm still getting the error

This solved the problem:
Remove "vendor" directory. Use "rm -rf vendor" if you in terminal
Remove composer.local file from root
Run "composer install"
– Jickson Johnson Koottala

First clear your cache.php artisan cache:clear. Then composer update

Related

How to run a project after clone from git repository [duplicate]

I get this error when I run the php artisan serve command to launch laravel am a beginner in laravel
PHP Warning: require(/home/matynjr/events/vendor/autoload.php): failed to open stream: No such file or directory in /home/matynjr/events/artisan on line 18
PHP Fatal error: require(): Failed opening required '/home/matynjr/events/vendor/autoload.php' (include_path='.:/usr/share/php') in /home/matynjr/events/artisan on line 18
run in your project root folder cmd with composer update command
You need to go to your project room and install dependencies. It says that there is no vendor folder. Vendor folder is a part of composer. It holds dependency files inside.
Run composer install in the project root. It is a good idea to run composer update after that.
If composer install / composer update isn't working for you, try:
composer install --ignore-platform-reqs
OR
composer update --ignore-platform-reqs
After this you should be able to run "php artisan serve".
For faster results you can use
composer update --verbose --prefer-dist
on your root folder run cmd by replacing root directory with cmd
or open new terminal, navigate to your project root folder and follow the steps below
1 run composer install
2 composer update
3 restart your app
4 then run php artisan serve
run composer install in the root directory of your project
In my case, there were some issues in composer.
I resolved it by running this command in cmd in project's root folder:
composer update
In my case, the error emerged because at some point I enter this two commands php "php artisan cache:clear" and "php artisan config:cache".
So, the way a solved my problem was:
Type first "php artisan cache:clear"
php artisan config:cache
npm update
composer update
and that's it.

Laravel 6 artisan package:discover rename bootstrap/cache/packages

After composer update I got an error:
In Filesystem.php line 146:
rename(/var/www/bootstrap/cache/packages.phpE7r5E4,/var/www/bootstrap/cache
/packages.php): No such file or directory
Artisan commands don't work anymore. Already tried:
composer du
composer install
composer update
I found the problem, my windows docker (version 2.1.0.3) sometimes fails to execute. I don't know how it looks like the packages.php file just got locked. So here is the recipe to fix:
I restarted windows,
deleted all the files inside bootstrap\cache
started the containers
run artisan optimize
run composer du
Everything went back to work like a magic. :)
run this command: composer dump-autoload This command will clean up all compiled files and their paths.
enter this command in your terminal for clear cache: php artisan cache:clear
For me deleting the composer.lock file and then running composer install fixed the issue.
I had the same error and these commands helped me:
1. composer dump-autoload
2. php artisan cache:clear
3. php artisan optimize:clear
Try:
composer dump-autoload
or:
artisan cache:clear
after you update or make changes to composer.json to refresh everything.

Script cache:clear returned with error code 255

I installed Symfony 4.2 via composer
composer create-project Symfony/website-skeleton my-project
everything works correctly, then I put the project in gitlab. a friend of mine tried to clone it on its own computer in order to work on the same project, and when he runs composer install
he got an error :
Script cache:clear returned with error code 255
Frankly, I tried everything I can find on the web and Stack Overflow but unfortunately, i didn't succeed.
Thanks in advance for any help
First: How I got the error:
I have a symfony 4.2 installed application in a folder called my-project
I copied the content of the project to another folder called my-App using CTRL-C then CTRL-V (copy-paste)
I put it to my gitlab project
My friend cloned the project and run Composer install and He got the Error
"Script cache:clear returned with error code 255"
Second: How I solved this:
Actually, when you make a CTRL-C and CTRL-V to the content of the symfony project folder, you are not copying everything, all the .files (dot files example .env, .test, .gitignore) are hidden.
in order to copy the other hidden files such as .env you should open your terminal and type "cp .env (to your location)" in my case, it was "cp .env ~/Desktop/newApp"
Hint: in order to display all the folders and files in a folder use "ll" (ll: aliased to "ls -lh") instead of "ls" command.
In my case was that I removed some packages that I didn't need from the composer.json but I forgot to remove them from config/bundle.php.
So check config/bundle.php and if you find something there that isn't right, go delete it!
Downgraded temporarily from composer 2 to composer 1. Then I had this error after doing composer req symfony/orm-pack.
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
[...Stacktrace...]
!!
Script #auto-scripts was called via post-update-cmd
Installation failed, reverting ./composer.json to its original content.
I had to remove #auto-scripts from my composer.json file. Not sure if this will lead to correct beahvior, but I was just followiing a tutorial.
Turn
"post-update-cmd": [
"#auto-scripts"
]
into
"post-update-cmd": [
""
]
I have this error message but the problem was with cache being deleted, solve it with
console cache:warnup
It happened to me too. Turns out my composer simply did not have enough memory available! Try this (it worked for me):
COMPOSER_MEMORY_LIMIT=-1 composer <your-composer-command-here>
I just had this error message.
I removed the SwiftMailer bundle but not the config swiftMailer.yml file
Symfony was unable to manage this configuration file
I solved this by removing the yml file
I have had the same problem, in my case when installing symfony version 4 and 5.
Error:
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
I solved it by downloading composer manually and running composer.phar :
php7.1 composer.phar create-project symfony/website-skeleton:"^4.4" symfony4
And now I have no problem installing symfony.

Laravel clear package auto-discovery cache of composer packages

I wanted to remove a package from laravel. I did composer remove vendor/package
It was all good on my dev, but when I deploy on production something went wrong and I cannot do anything now.
when I run
php artisan package:discover
I'm geting
In ProviderRepository.php line 208:
Class 'Laracasts\Flash\FlashServiceProvider' not found
I'm guessing I it is something to do with some kind of cache or maby config
but I cannot run this command,
php artisan config:clear
because I'm getting the same error message as above.
PS. I'm using Laravel 5.6
You may need clear the autoloader files if they get jammed up as it is looking at those cached files when php artisan config:clear runs, thus creating the jam.
Remove the following files and they will rebuild:
/bootstrap/cache/packages.php
/bootstrap/cache/services.php
I fixed my problem deleting a config file like so:
$rm bootstrap/cache/config.php
This file is basically a cache for config, if you want to have this file built for you just run a following artisan command:
$php artisan config:cache

Laravel artisan serve error

I get this error when I run the php artisan serve command to launch laravel am a beginner in laravel
PHP Warning: require(/home/matynjr/events/vendor/autoload.php): failed to open stream: No such file or directory in /home/matynjr/events/artisan on line 18
PHP Fatal error: require(): Failed opening required '/home/matynjr/events/vendor/autoload.php' (include_path='.:/usr/share/php') in /home/matynjr/events/artisan on line 18
run in your project root folder cmd with composer update command
You need to go to your project room and install dependencies. It says that there is no vendor folder. Vendor folder is a part of composer. It holds dependency files inside.
Run composer install in the project root. It is a good idea to run composer update after that.
If composer install / composer update isn't working for you, try:
composer install --ignore-platform-reqs
OR
composer update --ignore-platform-reqs
After this you should be able to run "php artisan serve".
For faster results you can use
composer update --verbose --prefer-dist
on your root folder run cmd by replacing root directory with cmd
or open new terminal, navigate to your project root folder and follow the steps below
1 run composer install
2 composer update
3 restart your app
4 then run php artisan serve
run composer install in the root directory of your project
In my case, there were some issues in composer.
I resolved it by running this command in cmd in project's root folder:
composer update
In my case, the error emerged because at some point I enter this two commands php "php artisan cache:clear" and "php artisan config:cache".
So, the way a solved my problem was:
Type first "php artisan cache:clear"
php artisan config:cache
npm update
composer update
and that's it.

Categories