我将一个软件包上传到packagist,并运行以下命令以在全球范围内对其进行要求:
composer global require emmajiugo/flutterwave-cli
此操作失败,并显示以下输出:
Changed current directory to /Users/emmanuelezejiugo/.composer
Using version ^1.3 for emmajiugo/flutterwave-cli
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for emmajiugo/flutterwave-cli ^1.3 -> satisfiable by emmajiugo/flutterwave-cli[v1.3].
- Conclusion: remove illuminate/container v5.8.28
- Conclusion: don't install illuminate/container v5.8.28
- emmajiugo/flutterwave-cli v1.3 requires laravel-zero/framework ^7.0 -> satisfiable by laravel-zero/framework[v7.0.0, v7.1.0, v7.2.0, v7.2.1].
- laravel-zero/framework v7.0.0 requires illuminate/container ^7.0 -> satisfiable by illuminate/container[v7.0.0, v7.0.1, v7.0.2, v7.0.3, v7.0.4, v7.0.5, v7.0.6, v7.0.7, v7.0.8, v7.1.0, v7.1.1, v7.1.2, v7.1.3, v7.10.0, v7.10.1, v7.10.2, v7.10.3, v7.11.0, v7.12.0, v7.13.0, v7.14.0, v7.14.1, v7.15.0, v7.16.0, v7.16.1, v7.17.0, v7.17.1, v7.17.2, v7.18.0, v7.19.0, v7.19.1, v7.2.0, v7.2.1, v7.2.2, v7.20.0, v7.3.0, v7.4.0, v7.5.0, v7.5.1, v7.5.2, v7.6.0, v7.6.1, v7.6.2, v7.7.0, v7.7.1, v7.8.0, v7.8.1, v7.9.0, v7.9.1, v7.9.2].
- laravel-zero/framework v7.1.0 requires illuminate/container ^7.0 -> satisfiable by illuminate/container[v7.0.0, v7.0.1, v7.0.2, v7.0.3, v7.0.4, v7.0.5, v7.0.6, v7.0.7, v7.0.8, v7.1.0, v7.1.1, v7.1.2, v7.1.3, v7.10.0, v7.10.1, v7.10.2, v7.10.3, v7.11.0, v7.12.0, v7.13.0, v7.14.0, v7.14.1, v7.15.0, v7.16.0, v7.16.1, v7.17.0, v7.17.1, v7.17.2, v7.18.0, v7.19.0, v7.19.1, v7.2.0, v7.2.1, v7.2.2, v7.20.0, v7.3.0, v7.4.0, v7.5.0, v7.5.1, v7.5.2, v7.6.0, v7.6.1, v7.6.2, v7.7.0, v7.7.1, v7.8.0, v7.8.1, v7.9.0, v7.9.1, v7.9.2].
- laravel-zero/framework v7.2.0 requires illuminate/container ^7.0 -> satisfiable by illuminate/container[v7.0.0, v7.0.1, v7.0.2, v7.0.3, v7.0.4, v7.0.5, v7.0.6, v7.0.7, v7.0.8, v7.1.0, v7.1.1, v7.1.2, v7.1.3, v7.10.0, v7.10.1, v7.10.2, v7.10.3, v7.11.0, v7.12.0, v7.13.0, v7.14.0, v7.14.1, v7.15.0, v7.16.0, v7.16.1, v7.17.0, v7.17.1, v7.17.2, v7.18.0, v7.19.0, v7.19.1, v7.2.0, v7.2.1, v7.2.2, v7.20.0, v7.3.0, v7.4.0, v7.5.0, v7.5.1, v7.5.2, v7.6.0, v7.6.1, v7.6.2, v7.7.0, v7.7.1, v7.8.0, v7.8.1, v7.9.0, v7.9.1, v7.9.2].
- laravel-zero/framework v7.2.1 requires illuminate/container ^7.0 -> satisfiable by illuminate/container[v7.0.0, v7.0.1, v7.0.2, v7.0.3, v7.0.4, v7.0.5, v7.0.6, v7.0.7, v7.0.8, v7.1.0, v7.1.1, v7.1.2, v7.1.3, v7.10.0, v7.10.1, v7.10.2, v7.10.3, v7.11.0, v7.12.0, v7.13.0, v7.14.0, v7.14.1, v7.15.0, v7.16.0, v7.16.1, v7.17.0, v7.17.1, v7.17.2, v7.18.0, v7.19.0, v7.19.1, v7.2.0, v7.2.1, v7.2.2, v7.20.0, v7.3.0, v7.4.0, v7.5.0, v7.5.1, v7.5.2, v7.6.0, v7.6.1, v7.6.2, v7.7.0, v7.7.1, v7.8.0, v7.8.1, v7.9.0, v7.9.1, v7.9.2].
- Can only install one of: illuminate/container[v7.0.0, v5.8.28].
- Can only install one of: illuminate/container[v7.0.1, v5.8.28].
- Can only install one of: illuminate/container[v7.0.2, v5.8.28].
- Can only install one of: illuminate/container[v7.0.3, v5.8.28].
- Can only install one of: illuminate/container[v7.0.4, v5.8.28].
- Can only install one of: illuminate/container[v7.0.5, v5.8.28].
- Can only install one of: illuminate/container[v7.0.6, v5.8.28].
- Can only install one of: illuminate/container[v7.0.7, v5.8.28].
- Can only install one of: illuminate/container[v7.0.8, v5.8.28].
- Can only install one of: illuminate/container[v7.1.0, v5.8.28].
- Can only install one of: illuminate/container[v7.1.1, v5.8.28].
- Can only install one of: illuminate/container[v7.1.2, v5.8.28].
- Can only install one of: illuminate/container[v7.1.3, v5.8.28].
- Can only install one of: illuminate/container[v7.10.0, v5.8.28].
- Can only install one of: illuminate/container[v7.10.1, v5.8.28].
- Can only install one of: illuminate/container[v7.10.2, v5.8.28].
- Can only install one of: illuminate/container[v7.10.3, v5.8.28].
- Can only install one of: illuminate/container[v7.11.0, v5.8.28].
- Can only install one of: illuminate/container[v7.12.0, v5.8.28].
- Can only install one of: illuminate/container[v7.13.0, v5.8.28].
- Can only install one of: illuminate/container[v7.14.0, v5.8.28].
- Can only install one of: illuminate/container[v7.14.1, v5.8.28].
- Can only install one of: illuminate/container[v7.15.0, v5.8.28].
- Can only install one of: illuminate/container[v7.16.0, v5.8.28].
- Can only install one of: illuminate/container[v7.16.1, v5.8.28].
- Can only install one of: illuminate/container[v7.17.0, v5.8.28].
- Can only install one of: illuminate/container[v7.17.1, v5.8.28].
- Can only install one of: illuminate/container[v7.17.2, v5.8.28].
- Can only install one of: illuminate/container[v7.18.0, v5.8.28].
- Can only install one of: illuminate/container[v7.19.0, v5.8.28].
- Can only install one of: illuminate/container[v7.19.1, v5.8.28].
- Can only install one of: illuminate/container[v7.2.0, v5.8.28].
- Can only install one of: illuminate/container[v7.2.1, v5.8.28].
- Can only install one of: illuminate/container[v7.2.2, v5.8.28].
- Can only install one of: illuminate/container[v7.20.0, v5.8.28].
- Can only install one of: illuminate/container[v7.3.0, v5.8.28].
- Can only install one of: illuminate/container[v7.4.0, v5.8.28].
- Can only install one of: illuminate/container[v7.5.0, v5.8.28].
- Can only install one of: illuminate/container[v7.5.1, v5.8.28].
- Can only install one of: illuminate/container[v7.5.2, v5.8.28].
- Can only install one of: illuminate/container[v7.6.0, v5.8.28].
- Can only install one of: illuminate/container[v7.6.1, v5.8.28].
- Can only install one of: illuminate/container[v7.6.2, v5.8.28].
- Can only install one of: illuminate/container[v7.7.0, v5.8.28].
- Can only install one of: illuminate/container[v7.7.1, v5.8.28].
- Can only install one of: illuminate/container[v7.8.0, v5.8.28].
- Can only install one of: illuminate/container[v7.8.1, v5.8.28].
- Can only install one of: illuminate/container[v7.9.0, v5.8.28].
- Can only install one of: illuminate/container[v7.9.1, v5.8.28].
- Can only install one of: illuminate/container[v7.9.2, v5.8.28].
- Installation request for illuminate/container (locked at v5.8.28) -> satisfiable by illuminate/container[v5.8.28].
Installation failed, reverting ./composer.json to its original content.
我尝试更改composer.json
文件中的一些内容,但仍然遇到问题。以下是我的composer.json
文件:
{
"name": "emmajiugo/flutterwave-cli",
"description": "A CLI app that helps you test Flutterwave payment on the go and also generate sample apps.",
"keywords": ["framework", "flutterwave", "rave", "rave cli", "flutterwave cli", "rave console", "flutterwave console", "cli"],
"homepage": "https://flutterwave.com",
"type": "project",
"license": "MIT",
"support": {
"issues": "https://github.com/emmajiugo/flutterwave-cli/issues",
"source": "https://github.com/emmajiugo/flutterwave-cli"
},
"authors": [
{
"name": "Chigbo Ezejiugo",
"email": "emmajiugo@gmail.com"
}
],
"require": {
"php": "^7.2.5",
"laminas/laminas-text": "^2.7",
"laravel-zero/framework": "^5.8",
"padraic/phar-updater": "^1.0.6",
"vlucas/phpdotenv": "^4.0",
"yuloh/open": "^0.1.0"
},
"require-dev": {
"mockery/mockery": "^1.3.1",
"phpunit/phpunit": "^8.5"
},
"autoload": {
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
},
"scripts": {
"post-create-project-cmd": [
"@php application app:rename"
]
},
"minimum-stability": "dev",
"prefer-stable": true,
"bin": ["flutterwave"]
}
答案 0 :(得分:3)
您是否尝试阅读错误消息?一行告诉您问题所在:
emmajiugo / flutterwave-cli v1.3需要laravel-zero / framework ^ 7.0
另一方面,您的composer.json
要求"laravel-zero/framework": "^5.8"
-这两个要求显然不能同时使用。您应该在您的库中需要较低版本的Laravel,或者在您的应用程序中需要较高版本的Laravel
答案 1 :(得分:2)
Composer的“全局安装”功能通过在特定目录中设置Composer项目并以常规方式进行管理来工作。为the manual states:
全局命令允许您像在COMPOSER_HOME目录中一样运行其他命令,例如安装,删除,要求或更新。
这仅仅是管理存储在中央位置的项目的助手,该项目可以容纳您想在任何地方使用的CLI工具或Composer插件。
这是理解您所看到的输出的关键,它开始于:
将当前目录更改为/Users/emmanuelezejiugo/.composer
此后发生的所有情况,就像您在该目录中运行常规的composer命令一样。
冲突的第一部分很简单:
导致冲突的原因显示在消息末尾:
这是指您将软件包“锁定”到composer.json
中用于您当前正在安装软件包的项目的特定版本。换句话说,您正在尝试为该项目添加两个相互矛盾的需求。
如上所述,该项目不是您的新库,而是您在/Users/emmanuelezejiugo/.composer
中创建的项目。因此,您需要更改的配置位于/Users/emmanuelezejiugo/.composer/composer.json
中。
最简单的解决方案可能是不将库安装在该文件夹中。如上所述,composer global
命令实际上除了为您更改目录外没有做任何事情;在大多数情况下,最好只为每个项目或工具创建一个目录,并在该目录中要求其依赖性,即使您只需要本地副本即可运行某些命令。
答案 2 :(得分:0)
谢谢。
我运行了composer global update
,它更新了所有必需的软件包。
然后composer global require repo-name/repo-package-name
做起来就很好了。