The oriceon-oauth-5-laravel package was installed by my friend and I pulled the code from git. I run the command composer update, but it throws the following error
exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Class 'Artdarek\OAuth\OAuthServiceProvider' not found' in /var/www/html/test/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php:146
I resolved this temporarily by commenting the service providers and aliases in app.php file.
So,what is the correct way to resolve this issue. Its happening after installing the packages in laravel 5.11
The problem is, in your config/app.php
file, you'll probably see this:
Artdarek\OAuth\OAuthServiceProvider::class,
in the list of providers. Since you haven't yet installed that package, the class doesn't exist. I think you figured that part out since you said you commented out the providers.
In composer.json
you'll see under scripts:
"pre-update-cmd": [
"php artisan clear-compiled"
],
That means that whenever you run composer update
, it first calls php artisan clear-compiled
, which loads your config files, which fails because of that missing class.
Two ways to get around it:
Change the provider to be a quote in strings like they were in Laravel 4:
"Artdarek\OAuth\OAuthServiceProvider",
(that's why nobody really had this problem until Laravel 5 / PHP 5.5). Or...
Real solution
Just run composer install
instead of composer update
. That's what you should be doing anyway, because whatever your teammate pushed was working with the versions of the libraries that are in composer.lock
. So if you run install, it's a) installing known working versions and b) bypassing that php artisan
command until after the install is finished.
If you really must run composer update
, then use it with the --no-scripts
flag