GitHub 作曲家包 - 最低稳定性
Posted
技术标签:
【中文标题】GitHub 作曲家包 - 最低稳定性【英文标题】:GitHub composer package - minimum-stability 【发布时间】:2019-08-12 18:32:28 【问题描述】:我的包在 Giblab 的私有存储库中运行,在将它导入 Github 后它无法运行, 当我尝试要求它时,我有一个错误:
[InvalidArgumentException] 找不到匹配的版本 软件包 lib_externe/XXX。检查包拼写,你的版本 约束和包是在一个稳定可用 符合您的最低稳定性 (dev)。
这是我的 composer.json 包:
"name": "lib-externe/XXX",
"description": "Lib metier V4",
"license": "proprietary",
"minimum-stability": "dev",
"require":
"php": ">=5.4.0"
前面的Composer.json是:
"repositories":
"lib_externe":
"type": "git",
"url": "https://xxx:yyy@github.com/zzz/zzz.lib_externe.git"
,
"minimum-stability": "dev",
"prefer-stable": true,
"require":
"lib-externe/XXX": "dev-master",
我尝试添加之前没有的那 2 行,但没有帮助:
"minimum-stability": "dev",
"prefer-stable": true,
另一个有趣的事情是,如果我删除了 vendor 目录和 composer.lock,并且如果我安装了 composer,它就可以工作,并且我会在 vendor 中看到我的 lib-externe 文件夹。但是在不可能要求之后(这个命令在 gitlab 中工作):
composer require lib_externe/XXX:dev-master
当我执行这条命令行时,我遇到了“最低稳定性”错误。 例如,我用@dev 尝试了很多不同的变体,但没有任何帮助
详细模式:
...
Reading composer.json of lib-externe/XXX (wip/HJ_ms_url_landing_maker)
Reading /root/.composer/cache/repo/XXXXXXXXXXXXXXXX from cache
Importing branch wip/HJ_ms_url_landing_maker (dev-wip/HJ_ms_url_landing_maker)
Downloading https://repo.packagist.org/packages.json
Writing /root/.composer/cache/repo/https---repo.packagist.org/packages.json into cache
Reading /root/.composer/cache/repo/https---repo.packagist.org/p-provider-2013.json from cache
Reading /root/.composer/cache/repo/https---repo.packagist.org/p-provider-2014.json from cache
Reading /root/.composer/cache/repo/https---repo.packagist.org/p-provider-2015.json from cache
Reading /root/.composer/cache/repo/https---repo.packagist.org/p-provider-2016.json from cache
Reading /root/.composer/cache/repo/https---repo.packagist.org/p-provider-2017.json from cache
Reading /root/.composer/cache/repo/https---repo.packagist.org/p-provider-2018.json from cache
Reading /root/.composer/cache/repo/https---repo.packagist.org/p-provider-2018-04.json from cache
Reading /root/.composer/cache/repo/https---repo.packagist.org/p-provider-2018-07.json from cache
Downloading http://repo.packagist.org/p/provider-2018-10%24ea06f25637c1c602d41ed345c80a660576d10be05261f8108e936462757cdd1f.json
Writing /root/.composer/cache/repo/https---repo.packagist.org/p-provider-2018-10.json into cache
Downloading http://repo.packagist.org/p/provider-2019-01%2489609fdd5aed8f456ecfe99afda1ac8b789147473448122af24d6c5104615a76.json
Writing /root/.composer/cache/repo/https---repo.packagist.org/p-provider-2019-01.json into cache
Reading /root/.composer/cache/repo/https---repo.packagist.org/p-provider-archived.json from cache
Downloading http://repo.packagist.org/p/provider-latest%249fafea8edeb232d8a026fe8fd8d1cbacbc6be44e759a39ed975e02facb658be1.json
Writing /root/.composer/cache/repo/https---repo.packagist.org/p-provider-latest.json into cache
Downloading https://packagist.org/search.json?q=lib_externe/XXX&type=
[InvalidArgumentException]
Could not find a matching version of package lib_externe/XXX. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (
dev).
Exception trace:
() at phar:///usr/local/bin/composer/src/Composer/Command/InitCommand.php:740
...
我尝试“作曲家清除缓存” 如果我在 composer.json 的“url”存储库中克隆 URL,它会正确克隆,并以详细模式登录,我会看到我的所有分支(包括主分支) 如果我检查缓存文件,我会看到包 composer.json :
"name":"lib-externe\/XXX","description":"Lib metier V4","license":"proprietary","minimum-stability":"dev","require":"php":">=5.4.0","time":"2018-04-16T10:40:23+00:00"
我没有标签,如果可能的话,我想暂时不要使用它们!
直到现在,在 Gitlab 中它一直以这种方式工作,
谢谢!
【问题讨论】:
【参考方案1】:问题只是包名中的错误('_'而不是'-'):
composer require lib_externe/XXX:dev-master
正确的名字是:
composer require lib-externe/XXX:dev-master
【讨论】:
在我的composer.json
中将版本更改为“dev-main”对我有帮助。以上是关于GitHub 作曲家包 - 最低稳定性的主要内容,如果未能解决你的问题,请参考以下文章