在 Copmposer 中不需要工作



我在项目上有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-这是我的repo,包含下一个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:components/curl.git-也是我的repo,它包含下一个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

Update2composer.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": []
}

Composer不会递归浏览存储库,即所有可能包含软件的存储库都必须在根composer.json文件中提及。

你没有提到pack/ccurl包的存储库,所以Composer找不到这个包。

我假设"pack"是您在问题中部分添加的供应商名称,因为错误消息仍然提到"shkarbatov"作为供应商名称。

避免在任何地方添加数百个个人存储库的最佳方法是拥有一个像Composer repo这样的包装学家,它在任何地方都被提及,并包含所有代码存储库的元数据。看看萨蒂斯。

更新:

现在,在看到您的composer.lock文件后,情况就清楚了:您不是在使用require来添加包,而是使用require-dev。这只适用于根包的开发依赖项(如添加PHPUnit或开发包所需的东西)-添加到根包中的包的任何开发依赖项都不会安装。

将生产使用所需的包的依赖项更改为require所有级别!

相关内容

  • 没有找到相关文章

最新更新