Search code examples
laravelcomposer-phplaravel-socialite

I can't install laravel/socialite package using composer


laravel-version: 7.24.0

os: windows

I run the following command in the command prompt. composer require laravel/socialite but it fails and the output is :

D:\...\xxx>composer require laravel/socialite
Using version ^4.4 for laravel/socialite
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
  - Installing league/oauth1-client (1.7.0): Loading from cache
  - Installing laravel/socialite (v4.4.1): Loading from cache
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In ProviderRepository.php line 208:

  Class 'Laravel\Socialite\SocialiteServiceProvider' not found


Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Installation failed, reverting ./composer.json to its original content.

I've tried dump-autoload, and clear configs but anything didn't help me.


Solution

  • The error occurs because socialite package wasn't really installed. I've checked vender/laravel directory, and socialite wasn't installed. composer tried to download socialite package but failed. But composer ignores the fail of socialite package, so after composer command completed, they can't find Class 'Laravel\Socialite\SocialiteServiceProvider'. I'm not sure why downloading socialite package, but I think it's mostly network problem(slow speed or blocked ip location, etc). So I solved by copying socialite package to vendor directory.