In ProviderRepository.php line 208: Class not found
I removed a composer package, with composer remove devdojo/chatter.
But getting to the end of the command output I got
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
In ProviderRepository.php line 208:
Class 'DevDojo\Chatter\ChatterServiceProvider' not found
Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1
So I can't run any of the artisan commands again. I keep getting
Class 'DevDojo\Chatter\ChatterServiceProvider' not found. Do I need to manually clear something?
I deleted the vendor folder, check to make sure the package is not in the composer.json file, reinstalled the vendor packages and I got the same error at the end of the command output
Running the below command (most recommended way to remove your package without updating your other packages)
$ composer remove vendor/package
2 . Go to your composer.json file and then run the command like below it will remove your package (but it will also update your other packages)
$ composer update
3 . If you are still getting the error after you have done with all above steps, go to your projects bootstrap->cache->config.php remove the provider & aliases entries from the cached array manually.
So I know this is old but maybe this will help as I ran into this exact same issue and about lost my mind.
I had cleared out the packages and services from everywhere in the project but they still kept breaking composer. dump-autoload would not work at all. what got me to see the issue was this.
Removing this file bootstrap/cache/config.php
that then broke the app in a way that actually made sense once I ran dump-autoload I got a message that app.php was broken which I had not noticed at all before that I had missed some parentheses and commas, ooof. So when I fixed those and then ran dump-autoload again then I found another layer of mistakes. I was able to fix those and then dump-autoload again and its all working.
So the point here is its probably a real code screw-up somewhere as package removal is very simple and is not really the root cause but rather a symptom that expressed oddly.
Hope this helps another internet stranger some day
I had similar problem with JWTAuth.
Go to bootstrap/cache/config.php. You'll see provider's array, find the offender delete the line and save file.
After that run:
composer dump-autoload
composer update
to remove that error just install that package again $ composer install vendor/package
it will refresh all file again and then after that if you dont want that package just remove package step by step
had the same issue when removing a custom nova tool in a feature branch that didn't get merged.
running composer dump-autoload -o solved for me :) thanks everyone
i also noticed that phpstorm was triggering a composer update check as a background process during the nova:tool install, so, I disabled the setting "Composer / Check for available package updates" and had no further issues.
I think i've found the solution guys,
i analyze from the composer file and i found it.
try to open folder vendor/composer/ and open installed.json in code editor,
search the package that you want to delete, and delete the array.
and now you can try composer dump-autoload