44

I tried to uninstall the spatie/Geocoder Package https://github.com/spatie/geocoder it from my laravel application, it pulled the package from Github but the package uninstallation was not successful.

Below is the Error that is returned by composer command

Terminal Screenshort:

enter image description here

Thanks In advance

Moaiz
  • 1,793
  • 3
  • 10
  • 24

10 Answers10

104

Issue is resolved by just follow these step. Go to your project > bootstrap->cache->config.php or packages.php remove the provider and aliases from the cached array manually.

hossein Q
  • 3
  • 3
Moaiz
  • 1,793
  • 3
  • 10
  • 24
17

Easiest thing for me was to just delete the files in /bootstrap/cache/. Those will get regenerated automatically.

Peter Drinnan
  • 4,344
  • 1
  • 36
  • 29
  • 2
    but the file apper again then error again – questionasker Dec 30 '20 at 02:09
  • first remove provider and alias from app.php. and then remove /bootstrap/cache direcotry, and then again create directory cache directory in bootstrap directory. onward run composer dump-autoload. – Bangash Mar 11 '21 at 07:48
14

Ultimately, the fix that worked for me:

Delete the folder "vendor", and run composer install once again.

A more specific fix may have been possible, but this cleans things up nicely anyhow.

Kalnode
  • 9,386
  • 3
  • 34
  • 62
8
  1. Run : composer update

  2. Run : composer dump-autoload

It works for me with Laravel 8.x

6

Remove the lines below:

// config/app.php
'providers' => [
    '...',
    Spatie\Geocoder\GeocoderServiceProvider::class
];
// config/app.php
'aliases' => array(
    ...
    'Geocoder' => Spatie\Geocoder\Facades\Geocoder::class,
)

Run 'composer du' in your server console.

Arthur Samarcos
  • 3,262
  • 22
  • 25
  • 2
    Already remove these lines from config file but not working showing same error @arthur Samarcos – Moaiz Dec 10 '18 at 11:46
5

This is what sorted it for me.

I navigated to

project > bootstrap->cache folder.

There, was this file

packages.php

I deleted that.

rm packages.php

Then I ran

composer dump-autoload

Please note that, before running the above command, I tried running the following but it did not work

composer dump-autoload --no-dev

I ran the above in production.

hackernewbie
  • 1,606
  • 20
  • 13
2

Use these 3 commands to fix the Error.

composer install --optimize-autoloader --no-dev
    
php artisan config:cache

php artisan cache:clear
0

Remove the JeroenNoten\LaravelAdminLte\ServiceProvider::class from the config/app.php will solve the problem

Rifky Niyas
  • 1,737
  • 10
  • 25
0

Deleting the cache is not a suitable option (for me), as it seems to regenerate a new one with an error. Another solution (above) is to modify the cache, and remove the error that way, but that didn't solve it either.

My error occurred trying to restore a non-working website version that was partially upgraded. My composer file was not valid and the requirements in it were wrong. I removed all the conflicting requirements using the composer remove command.

But then I got the error above with the CashierServiceProvider class. If this exists on another class for you, the solution I used might work but you will need to do this for your class.

First, commenting the Cashier Service worked for me in app\config.php got rid of the error.

Laravel\Cashier\CashierServiceProvider::class,

Then I installed the cashier Laravel app.

composer require laravel/cashier
Michael Parisi
  • 133
  • 2
  • 8
0

In such issues the below are the magic-commands recommended for Laravel:

rm -rf bootstrap/cache/*
php artisan clear-compiled
composer dumpautoload
php artisan view:clear
php artisan config:clear
php artisan route:clear
php artisan config:cache
php artisan cache:clear
Imran Zahoor
  • 2,521
  • 1
  • 28
  • 38