'Laravel composer update error: Nothing to install or update

When I run composer update, I get the following error:

Loading composer repositories with package information Updating dependencies (including require-dev) Nothing to install or update Generating autoload files Illuminate\Foundation\ComposerScripts::postUpdate php artisan optimize [Symfony\Component\Debug\Exception\FatalErrorException] Class 'Laravel\Cashier\CashierServiceProvider' not found Script php artisan optimize handling the post-update-cmd event returned with err or code 255

I put this code on the app.php file

Laravel\Cashier\CashierServiceProvider::class,

and in the composer.json I also put this

"laravel/cashier": "~6.0"

like in the laravel doc

stack errot



Solution 1:[1]

Remove the

Laravel\Cashier\CashierServiceProvider::class,

from app.php. It needs to be added after installing the package.

Also, instead of composer update, try composer require without changing the composer.json file.

composer require laravel/cashier

Solution 2:[2]

Don't add anything in composer.json file or app.php.

Just follow the documentation given in Laravel website for Laravel Cashier, (select the laravel version which you are using in your project).

Run the commands in following order:

//install the package and add it in composer file
 composer require laravel/cashier

//add your cashier class in 'providers' array in app.php
 Laravel\Cashier\CashierServiceProvider::class,

//add alias in 'aliases' array in app.php
'Cashier' => Laravel\Cashier\CashierServiceProvider::class,

//will add several columns to users table & create a new subscriptions table
 php artisan migrate

Solution 3:[3]

  1. Check the php version in cmd useing php -v
  2. if php version is < 7.0 then install latest version of php.
  3. Uninstall the old verion Xampp
  4. Install latest version of Xampp to upgrade php.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Ankit Jindal
Solution 3 deekshitha k