我的包在Giblab的私有存储库中可以工作,在导入Github后就无法工作了, 当我尝试要求它时,出现了错误:
[InvalidArgumentException] 找不到匹配的版本 包lib_externe/XXX。检查包名称拼写,您的版本约束条件以及该包是否在与您的最小稳定性相匹配的可用性中。
这是我的包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",
}
}
我尝试添加这两行以前没有的代码,但并没有帮助:
"minimum-stability": "dev",
"prefer-stable": true,
另一个有趣的事情是,如果我删除vendor目录和composer.lock文件,并执行composer install,它可以正常工作,并且我可以在vendor中看到我的lib-externe文件夹。但之后无法使用require命令(这个命令在gitlab中是有效的):
composer require lib_externe/XXX:dev-master
当我执行这个命令行时,出现了“minimum-stability”错误。我尝试了许多不同的变体,例如@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 clear-cache”命令
如果我在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中是这样工作的,
谢谢!
composer.json
文件中将版本更改为 "dev-main" 对我很有帮助。 - Ryan