Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel unable to add new package

I am unable to add new package in a Laravel 7.2 project. I was trying to run this command

composer require stripe/stripe-php

but I got below error.

    Problem 1
        - Root composer.json requires kreait/laravel-firebase ^3.0, 
found kreait/laravel-firebase[3.0.0] 
but the package is fixed to 2.2.0 (lock file version) 
by a partial update and that version does not match. 
Make sure you list it as an argument for the update command.

Use the option --with-all-dependencies (-W) to allow upgrades,
downgrades and removals for packages currently locked to specific versions.

I also tried composer update but I am still getting this error.

like image 499
Bilal Rabbi Avatar asked Oct 23 '25 19:10

Bilal Rabbi


2 Answers

From what I can see, your composer.json file has an outdated version of kreait/laravel-firebase package. stripe/stripe-php requires kreait/laravel-firebase version that is > 3.0 & your version is 3.0.0. Change the version of the kreait/laravel-firebase in your composer.json, then delete composer.lock file, and then composer install again. That way, all your packages will be updated to the new specified version. Without deleting composer.lock file, composer would only install cached versions of your packages, even if you change the versions.

like image 198
zlatan Avatar answered Oct 26 '25 08:10

zlatan


You have to modify your composer.json file according to the error package version, In your case change from kreait/laravel-firebase ^3.0 to kreait/laravel-firebase ^3.0.0 Then Delete composer.lock file and run composer install command. Hopefully it will fix your problem.

like image 35
Faisal Mirza Avatar answered Oct 26 '25 09:10

Faisal Mirza



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!