33

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,593
  • 1
  • 9
  • 21

14 Answers14

95

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

Moaiz
  • 1,593
  • 1
  • 9
  • 21
13

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

Peter Drinnan
  • 4,166
  • 1
  • 33
  • 29
  • 2
    but the file apper again then error again – zukijuki 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
8

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.

MarsAndBack
  • 7,900
  • 3
  • 27
  • 50
4
  1. Run : composer update

  2. Run : composer dump-autoload

It works for me with Laravel 8.x

3

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,172
  • 20
  • 24
  • 2
    Already remove these lines from config file but not working showing same error @arthur Samarcos – Moaiz Dec 10 '18 at 11:46
2

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,166
  • 14
  • 9
0

I got the same problem on my previous laravel project.

Try first an:

service apache2 restart

Or any similar command depending on your OS, e.g. I restarted my wamp server.

then on your Laravel folder :

composer dump-autoload

hope it helps.

brucelin
  • 819
  • 2
  • 10
  • 23
0

I ran into this exact same issue. I tried dump-autoload, clear config and more and nothing worked. In the end I went and removed the config.php from bootstrap/cache and then ran composer dump-autoload. That worked.

louis_coetzee
  • 351
  • 5
  • 13
0

first check composer.json file, under the psr-4 key from autoload section ,you can define a mapping from namespaces to paths, relative to the package root.

   {
"autoload": {
    "psr-4": {
         "Spatie\\Geocoder\\": "src" //<<---For example, in your case, this mapping should be done
    }
}

}

and then run the following command to regenerates the list of all classes that need to be included in the project

composer dump-autoload

for more information and example look at this link https://getcomposer.org/doc/04-schema.md#autoload

fatemeh sadeghi
  • 885
  • 6
  • 13
  • Please add some explanation to your answer such that others can learn from it - which mappings should be added for a package that is not installed? – Nico Haase Apr 24 '20 at 21:38
  • Thanks for your guidance I'm sorry if it wasn't clear. I have added more details and I hope it is useful. – fatemeh sadeghi Apr 25 '20 at 01:14
  • You still haven't told why this should be needed. The OP removed that package, so nothing from that namespace should be loaded. – Nico Haase Apr 25 '20 at 07:19
  • my language is not English ,Please add some explanation to your comment ;)what is OP? this error is not related to just this package and it is throw with laravel core . i have got this error with laravel modules package installation, and i set same config to fixed it! – fatemeh sadeghi Apr 25 '20 at 15:45
0

Try to either completely delete app\config.php file or remove provider/aliases in app\config.php associated with Spatie\Geocoder\GeocoderServiceProvider.

Abhishek Singh
  • 399
  • 6
  • 7
0

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

Rifky Niyas
  • 1,063
  • 5
  • 20
0

Use these 3 commands to fix the Error.

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

php artisan cache:clear
0

For those trying to deploy changes to files with a different casing that were already committed to git, it's a bit different. In my case, my VerificationServiceProvider was misnamed, so even after correcting the naming from VerificationserviceProvider to VerificationServiceProvider, the issue didn't go away on production. I had to Untrack the file with github, then rename it and add it back before the issue went away. Guess its a Linux file casing issue

Thanks everyone

myestery
  • 75
  • 1
  • 11
-3

In app\config.php

Replace

JeroenNoten\LaravelAdminLte\ServiceProvider::class,

with

JeroenNoten\LaravelAdminLte\AdminLteServiceProvider::class,

and do whatever you want afterwards.

Jay Momaya
  • 1,548
  • 16
  • 27