我喜欢创建一个新的composer项目。我将包括代码,这不是在packagist上。它是一个github存储库。具体地说,我喜欢包含这个版本。
https://github.com/joomla/joomla-cms/releases/tag/4.0.0-alpha12
我期望使用此composer.json获取版本4.0.0-alpha12:
{
"name": "vendor/my_joomla_website",
"description": "Testing to install joomla with extensions via composer",
"type": "project",
"license": "GNU",
"authors": [
{
"name": "vendor",
"email": "myemail"
}
],
"repositories": [
{
"type": "git",
"url": "https://github.com/joomla/joomla-cms.git"
}
],
"require": {
"joomla/joomla-cms": "dev-4.0-dev#4.0.0-alpha12"
}
}但是命令comoser install并没有运行到最后。这是我的留言
composer install
Loading composer repositories with package information
[Symfony\Component\Process\Exception\ProcessTimedOutException]
The process "git clone --mirror 'https://github.com/joomla/joomla-cms.git' '/home/astrid/.composer/cache/vcs/htt
ps---github.com-joomla-joomla-cms.git/'" exceeded the timeout of 300 seconds.
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...最后,我在我的项目文件夹中有一个供应商目录。github存储库的内容不在那里。
如果我想要将托管在github上的代码添加到我的Composer项目中,我必须做些什么?
更新我刚刚把我的composer.json改成了
{
"name": "astrid/my_joomla_website",
"description": "Testing to install joomla with extensions via composer",
"type": "project",
"license": "GNU",
"authors": [
{
"name": "vendor",
"email": "myemail"
}
],
"repositories": [
{
"type": "package",
"package": {
"name": "joomla/joomla-cms",
"version": "4.0.0-alpha12",
"source": {
"type": "git",
"url": "git://github.com/joomla/joomla-cms.git",
"reference": "4.0-dev"
},
"dist": {
"url": "https://github.com/joomla/joomla-cms/releases/download/4.0.0-alpha12/Joomla_4.0.0-alpha12-Alpha-Full_Package.zip",
"type": "zip"
}
}
}
],
"require": {
"joomla/joomla-cms": "dev-4.0-dev#4.0.0-alpha12"
}
}现在我得到了这个错误。
composer install
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package joomla/joomla-cms dev-4.0-dev#4.0.0-alpha12 exists as joomla/joomla-cms[4.0.0-alpha12] but these are rejected by your constraint.我做错了什么?我还没有分配任何依赖项或限制。
发布于 2020-01-30 18:42:31
我不确定到底是什么原因导致您的“被您的约束拒绝”异常,但我猜这是因为您使用的是docs所说的不受积极支持的branch#ref版本要求。我认为您可以只使用4.0.0-alpha12标记,因为标记并不绑定到分支。
要解决第一个问题,请将存储库类型更改为vcs (或github)。Composer将检测到存储库是Github存储库,然后使用Github API获取正确版本的包。joomla-cms repository看起来真的很大,所以它可能会花费比允许的300秒更长的时间来克隆。
"repositories": [
{
"type": "vcs",
"url": "https://github.com/joomla/joomla-cms.git"
}
]对于第二个问题,请将版本设置为4.0.0-alpha12
"require": {
"joomla/joomla-cms": "4.0.0-alpha12"
}joomla-cms的4.0.0-alpha12版本需要joomla/application (joomla/application[2.0.x-dev])的开发版本,因此您必须将软件包的minimum stability设置为dev
"minimum-stability": "dev",https://stackoverflow.com/questions/59918949
复制相似问题