简体   繁体   English

Laravel 无法添加新的 package

[英]Laravel unable to add new package

I am unable to add new package in laravel project.我无法在 laravel 项目中添加新的 package。 I am using laravel 7.2 I was trying to run this command我正在使用 laravel 7.2 我正在尝试运行此命令

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 still getting this error.我也尝试了 composer update 但仍然收到此错误。

From what I can see, your composer.json file has an outdated version of kreait/laravel-firebase package.据我所知,您的composer.json文件的kreait/laravel-firebase firebase package 版本已过时。 stripe/stripe-php requires kreait/laravel-firebase version that is > 3.0 & your version is 3.0.0 . stripe/stripe-php需要kreait/laravel-firebase版本 > 3.0并且您的版本是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.在 composer.json 中更改kreait/laravel-firebase的版本,然后删除composer.json文件,然后再次composer install composer.lock 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.如果不删除composer.lock文件,即使您更改了版本,composer 也只会安装包的缓存版本。

Just delete the composer.json and composer install everything will be fixed.只需删除composer.jsoncomposer install一切都会得到修复。

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.您必须根据错误 package 版本修改您的 composer.json 文件,在您的情况下,从kreait/laravel-firebase ^3.0更改为 kreait/laravel- kreait/laravel-firebase ^3.0.0然后删除composer.lock文件并运行composer install命令。 Hopefully it will fix your problem.希望它能解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM