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

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.

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-Permission - permission not found in artisan list - There are no commands defined in the "permission" namespace

Hello Good Developers,
I am using spatie:laravel-permissions package in my application. I have identical code in local machine and production server.
I am having a strange issue with my production environment.
I cannot find permission in list of commands in php artisan list.
When I execute php artisan permission:cache-reset it says
There are no commands defined in the "permission" namespace.
I tried following things to fix this issue
Spatie\Permission\PermissionServiceProvider::class, in app.php
providers
composer update
composer dump-autoload
Cleared all config and application cache.
deleted vendors directory and executed composer install to reinstall all the packages.
Still its not working.
However when I execute dump-autoload it says Discovered Package: spatie/laravel-permission
I am using Laravel 5.7.28 and spatie/laravel-permission:^2.5
My Local system is working fine and I can see permission command in the list there.
Please help! I don't know where should I check now.
Try to run this command:
php artisan optimize:clear
If, for some reason, the command doesn't work, run these one by one:
php artisan view:clear
php artisan cache:clear
php artisan route:clear
php artisan config:clear
php artisan clear-compiled
After one of the above steps, if you are in production environment, run: php artisan config:cache

Class 'Illuminate\Cache\CacheServiceProvider' not found

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

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