php 作曲家 - 请求的包存在,但这些被您的约束拒绝
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39974833/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Composer - The requested package exists as but these are rejected by your constraint
提问by Antoine Bourlart
When I run my install from composer, I have this error :
当我从 Composer 运行安装时,出现此错误:
λ composer install You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebugLoading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages.
λ composer install 您正在运行 composer 并启用 xdebug。这对运行时性能有重大影响。请参阅https://getcomposer.org/xdebug使用包信息加载 composer 存储库 更新依赖项(包括 require-dev) 您的需求无法解析为一组可安装的包。
Error :
错误 :
Problem 1 - The requested package antoineb1/smoney_bundle 1.0 exists as antoineb1/smoney_bundle[dev-master] but these are rejected by your constraint.
问题 1 - 请求的包 antoineb1/smoney_bundle 1.0 作为 antoineb1/smoney_bundle[dev-master] 存在,但这些被您的约束拒绝。
My composer.json
我的composer.json
{
"name": "project",
"license": "proprietary",
"type": "project",
"minimum-stability": "dev",
"prefer-stable" : true,
"autoload": {
"psr-4": {
"": "src/"
}
},
"config": {
"preferred-install": "dist"
},
"repositories": [
{
"url": "bitbucket url",
"type": "vcs"
}
],
"require": {
"php": ">=5.5.9",
"antoineb1/smoney_bundle": "1.0"
}
}
回答by BVengerov
The version constraint "1.0"
is interpreted internallyas "1.0.0.0-stable"
version.
版本约束"1.0"
在内部被解释为"1.0.0.0-stable"
版本。
But the only version available is:
但唯一可用的版本是:
antoineb1/smoney_bundle[dev-master].
antoineb1/smoney_bundle[开发大师]。
So you could change the specified version to either one of the following depending on what version is suitable for you:
因此,您可以根据适合您的版本将指定版本更改为以下任一版本:
1.0.*
(which is seen by composer as>=1.0.0.0-dev <1.1.0.0-dev
-- probably won't work because there obviously aren't any versions in that package)dev-master
dev-master#<hash>
@dev
- etc.
1.0.*
(作曲家将其视为>=1.0.0.0-dev <1.1.0.0-dev
-- 可能不起作用,因为该包中显然没有任何版本)dev-master
dev-master#<hash>
@dev
- 等等。
See the composer schemafor reference.
请参阅Composer 架构以供参考。
回答by MikeiLL
The comment by @Guillaume below this answerdeserves a larger presentation.
@Guillaume 在这个答案下面的评论值得更大的展示。
It seems that composer wants a git releasethat has a v
in it.
看来,作曲家想要一个git的版本,有一个v
在里面。
So it should be v1.1.0
and not 1.1.0
.
所以应该是v1.1.0
而不是1.1.0
。
I spent about 90 minutes looking at
我花了大约 90 分钟看
mikeill/my_repo 3.3.10 requires composer/installers 1.0.*@dev -> satisfiable by composer/installers[1.0.x-dev, v1.0.0, ...] but these conflict with your requirements or minimum-stability.
mikeill/my_repo 3.3.10 requires composer/installers 1.0.*@dev -> satisfiable by composer/installers[1.0.x-dev, v1.0.0, ...] but these conflict with your requirements or minimum-stability.
And a lot of github issues as well as an SO post or two before finally discovering this thread.
在最终发现这个线程之前,还有很多 github 问题以及一两个 SO 帖子。
回答by OllieLowson
I lost a significant amount of hair, time and sanity over this question for a while - it turned out that the problem in my case was that I was specifying a version in the composer.json within the package itself as "dev-master".
有一段时间我在这个问题上失去了大量的头发、时间和理智 - 结果证明我的问题是我在包本身的 composer.json 中将一个版本指定为“dev-master”。
Refer to: https://getcomposer.org/doc/04-schema.md#version
参考:https: //getcomposer.org/doc/04-schema.md#version
Where it states:
它指出:
Note: Packagist uses VCS repositories, so the statement above is very much true for Packagist as well. Specifying the version yourself will most likely end up creating problems at some pointdue to human error.
注意:Packagist 使用 VCS 存储库,因此上面的陈述对于 Packagist 也非常正确。由于人为错误,您自己指定版本很可能最终会在某些时候产生问题。
(emphasis mine)
(强调我的)
I removed this version element and it worked perfectly :)
我删除了这个版本元素,它工作得很好:)
回答by sibaz
I came across this question, and found another issue, which I had completely forgotten about, which someone may find useful to have to check.
我遇到了这个问题,并发现了另一个我完全忘记的问题,有人可能会觉得必须检查它很有用。
In my case I had a very old git project, which had been forked some time back, and I had to merge them together (albeit the forked project hadn't had many changes). So I identified the split point on the old project, and tagged it as version for composer, so I could use that in place of the new project.
就我而言,我有一个非常旧的 git 项目,它在一段时间前被分叉了,我不得不将它们合并在一起(尽管分叉的项目没有太多变化)。所以我确定了旧项目的分割点,并将其标记为作曲家的版本,这样我就可以用它来代替新项目。
What I had forgotten though, was that originally we didn't use composer. So the file structure at the tag point was missing composer.json. I couldn't figure out why my new tags weren't appearing on the 'exists as' list of things which were 'rejected by your contraint'. Eventually I realised I had to create a branch on the old tag, cherry-pick the commit which created the composer.json for the project, and retag that, and then it all worked.
不过我忘记了,最初我们没有使用作曲家。所以标记点的文件结构缺少 composer.json。我不明白为什么我的新标签没有出现在“被你的限制拒绝”的“存在为”列表中。最终我意识到我必须在旧标签上创建一个分支,挑选为项目创建 composer.json 的提交,然后重新标记它,然后一切正常。
Hopefully this will jog someones memory, if they come hunting with this error message in mind.
希望这会唤醒某人的记忆,如果他们带着这个错误消息来狩猎的话。