我在项目上有composer.json:
{
"repositories": [
{
"type": "vcs",
"url": "git@git.test.ua:bmp/composer.git"
}
],
"require": {
"pack/composer": "dev-master"
},
"minimum-stability": "dev"
}
git@git.test.ua:bmp/composer.git - 这是我的回购,包含下一个composer.json文件:
{
"name": "pack/composer",
"repositories": [
{
"type": "vcs",
"url": "git@git.test.ua:components/curl.git"
}
],
"minimum-stability": "dev",
"require": {
"php": ">=5.4.0",
"pack/curl": "dev-master"
},
"autoload": {
"psr-4": {
"pack\\composer\\": ""
}
}
}
git@git.test.ua:component/curl.git - 也是我的回购,包含下一个composer.json文件:
{
"name": "pack/curl",
"autoload": {
"psr-4": {
"pack\\curl\\": ""
}
},
"minimum-stability": "dev"
}
当我尝试在我的项目上安装composer时,我收到下一个错误:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for pack/composer dev-master -> satisfiable by pack/composer[dev-master].
- pack/composer dev-master requires pack/curl dev-master -> no matching package found.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
我已经添加了参数:
"minimum-stability": "dev"
如果我从seckond composer.json文件中删除require部分,则不再出错。
"pack/curl": "dev-master"
如何修复它,我需要这个吗?
更新
{
"repositories": [
{"type": "vcs", "url": "https://git.test.ua/components/composer.git"},
{"type": "vcs", "url": "https://git.test.ua/components/curl.git"}
],
"require-dev": {
"pack/composer": "dev-master"
},
"minimum-stability": "dev"
}
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing pack/composer (dev-master 886d220)
Cloning 886d22082d4aa341731ebd87f280ee0f5a05fe37
Writing lock file
Generating autoload files
Update2 composer.lock文件
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "cc5c1fc7000544f6cfd9ba03a3ee4567",
"packages": [],
"packages-dev": [
{
"name": "pack/composer",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://git.test.ua/components/composer.git",
"reference": "886d22082d4aa341731ebd87f280ee0f5a05fe37"
},
"require-dev": {
"pack/curl": "dev-master"
},
"type": "library",
"autoload": {
"psr-4": {
"pack\\composer\\": ""
}
},
"time": "2015-04-24 07:13:31"
}
],
"aliases": [],
"minimum-stability": "dev",
"stability-flags": {
"pack/composer": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}
答案 0 :(得分:1)
Composer不会递归浏览存储库,即必须在根composer.json
文件中提及可能包含软件的所有存储库。
你没有提到那里的pack / curl包的存储库,因此Composer找不到这个包。
我认为“pack”是您在问题中部分添加的供应商名称,因为错误消息仍然提到“shkarbatov”作为供应商名称。
避免在任何地方添加数百个个人存储库的最佳方法是拥有一个类似于包装器的Composer仓库,它随处可见并包含所有代码存储库的元数据。看看Satis。
<强>更新强>
现在看到你的composer.lock文件后,情况很明显:你没有使用require
来添加你的包,而是require-dev
。这仅适用于根包的开发依赖(如添加PHPUnit或开发包所需的东西) - 未安装添加到根包的任何dev依赖项。
将生产使用所需的软件包的依赖关系更改为require
所有级别!