我在从私人GitLab存储库安装私人作曲家库时遇到问题。
我要使用的私有库的composer.json
中有这个私有库,并存储在我的GitLab中:
{
"name": "zlatan/app-client",
"type": "library",
"license": "MIT",
"description": "Client in PHP",
"authors": [
{
"name": "Zlatan Omerovic",
"email": "gmail@com.zlatan"
}
],
"require": {
"symfony/http-client": "^4.3"
},
"autoload": {
"psr-4": {
"AppClient\\": "src/"
}
}
}
我到库的Git路径为:/namespace/project/app-client.git
,即
git@zlatan.gitlab.com:namespace/project/app-client.git
现在我想在另一个zlatan/app-client
文件中使用命名为composer.json
的库:
{
"name": "zlatan/composer",
"authors": [
{
"name": "Zlatan Omerovic",
"email": "gmail@com.zlatan"
}
],
"require": {
"zlatan/app-client": "master"
},
"repositories": [
{
"type": "git",
"url": "git@zlatan.gitlab.com:namespace/project/app-client.git"
}
]
}
现在,当我运行composer install
时,总是得到以下输出:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package zlatan/app-client could not be found in any version, there may be a typo in the package name.
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://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
- It's a private package and you forgot to add a custom repository to find it
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
我的第一个也是唯一的猜测是URI中的这些GitLab名称空间/前缀会引起问题吗?
有可能解决这个问题吗?
答案 0 :(得分:1)
尝试使用dev-master
引用您的master分支。
使用master
将指示Composer搜索名为master
的标签,如果该标签不存在,它将失败。
此外,您可以尝试将"minimum-stability": "dev"
添加到composer.json
中,以确保可以安装软件包的开发版本。