我需要安装https://github.com/PHPGangsta/GoogleAuthenticator但如果我运行 Composer require "PHPGangsta/GoogleAuthenticator:1.0.1"我会收到错误:
Your requirements could not be resolved to an installable set of packages.
Problem 1 - The requested package phpgangsta/googleauthenticator 1.0.1 exists as phpgangsta/googleauthenticator[dev-master] but these are rejected by your constraint.
这里是composer.json,其中仅对PHP版本进行限制。
{
"require": {
"php": ">=5.6.1",
"league/oauth1-client": "^1.7",
"mongodb/mongodb": "^1.3",
"ruflin/elastica": "^5.3"
}
}
有人可以帮我解释一下这是什么问题吗?
最佳答案
我认为软件包中没有 1.0.1
版本。
当您运行 composer show --available phpgangsta/googleauthenticator
命令时,您可以看到可能的版本,但只有 dev-master
。
而且这个版本还不是稳定版本。 Composer 默认只想安装包中的稳定版本,但没有。
因此,如果您想在项目中使用它,则需要使用 composer require --prefer-dist phpgangsta/googleauthenticator:dev-master
命令进行安装。
关于php - Composer - 请求的包 phpgangsta/googleauthenticator 1.0.1 作为 [dev-master] 存在,但这些被您的约束拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58235660/