我尝试从github(designmodo / Flat-UI)添加存储库,玩配置并获取错误No valid composer.json was found in any branch or...
,Your requirements could not be resolved to an installable set of packages.
,The requested package designmodo/flat-ui could not be found in any version
我在配置中犯了什么错误:
"repositories": {
"flat-ui": {
"type": "package",
"package": {
"name": "designmodo/Flat-UI",
"version": "1.3.0", // Don't know is it important? Where get this number in repo?
"source": {
"url": "https://github.com/designmodo/Flat-UI",
"type": "git",
"reference": "dev-master" // reference is branch name?
}
}
}
},
"require": {
"twbs/bootstrap-sass": "~3.2",
"designmodo/Flat-UI": "dev-master" // branch again (/minimum-stability?)
},
在某些时候作曲家下载包但返回错误(我不知道他什么时候这样做,我在供应商文件夹和designmodo文件夹中查找了)。
答案 0 :(得分:12)
问题解决了。到处游玩,将reference
更改为master
,将版本更改为*
部分中的任意"designmodo/Flat-UI": "*"
。之后,作曲家通过git下载包并更新composer.lock
没有问题。应该适用于任何github回购。
工作配置:
{
"repositories": {
"flat-ui": {
"type": "package",
"package": {
"name": "designmodo/Flat-UI",
"version": "1.3.0",
"source": {
"url": "https://github.com/designmodo/Flat-UI",
"type": "git",
"reference": "master"
}
}
}
},
"require": {
"twbs/bootstrap-sass": "~3.2",
"designmodo/Flat-UI": "*"
},
}
答案 1 :(得分:6)
它只能帮我删除标签,如下所示:
{
"repositories":[
{
"type": "package",
"package": {
"name": "designmodo/Flat-UI",
"version": "1.3.0",
"source": {
"url": "https://github.com/designmodo/Flat-UI",
"type": "git",
"reference": "master"
}
}
}
],
"require": {
"twbs/bootstrap-sass": "~3.2",
"designmodo/Flat-UI": "*"
},
}
答案 2 :(得分:0)
我遇到了类似的问题:除了添加 Git 存储库之外,我还想包含一个 SVN 存储库(没有 composer.json
)和一个 ZIP 文件。上面的解决方案对我不起作用。
使用 Composer(版本 1)时,我收到以下错误消息:
<块引用>问题 1 - 请求的包 XXX 无法在任何 版本,包名可能有拼写错误。
升级到 Composer 版本 2 有帮助,因为错误消息更有帮助:
<块引用>问题 1 - 根 composer.json 需要 XXX *,找到 XXX[master] 但是 它与您的最低稳定性不匹配。
所以解决方案是add "@dev" behind the required version。此外,我必须在 "secure-http": false
部分包含 config
,因为 ZIP 文件来自没有 HTTPS 的页面。
这是我的完整 composer.json
文件:
{
"prefer-dist": true,
"repositories": {
"viathinksoft/vnag": {
"type": "package",
"packagist.org": false,
"package": {
"name": "viathinksoft/vnag",
"version": "master",
"license": "Apache-2.0",
"source": {
"url": "https://svn.viathinksoft.com/svn/vnag/",
"type": "svn",
"reference": "trunk/"
}
}
},
"dcodeio/bcrypt.js": {
"type": "package",
"packagist.org": false,
"package": {
"name": "dcodeio/bcrypt.js",
"version": "master",
"license": [
"BSD-3-Clause",
"MIT"
],
"source": {
"url": "https://github.com/dcodeio/bcrypt.js",
"type": "git",
"reference": "master"
}
}
},
"spamspan/spamspan": {
"type": "package",
"packagist.org": false,
"package": {
"name": "spamspan/spamspan",
"version": "master",
"license": "GPL-2.0-only",
"dist": {
"url": "http://www.spamspan.com/releases/spamspan-latest.zip",
"type": "zip",
"reference": "master"
}
}
}
},
"require": {
"dcodeio/bcrypt.js": "*@dev",
"viathinksoft/vnag": "*@dev",
"spamspan/spamspan": "*@dev"
},
"config": {
"secure-http": false,
"preferred-install": {
"*": "dist"
}
}
}
我还想解释一下我这样做的原因:
这些是三个没有 composer.json
文件的第三方产品的示例。我知道“bcrypt.io”是一个npm
项目,理论上我可以使用npm
来下载它,我可以手动下载和解压postinstall
部分的ZIP文件作曲家。
但是,我希望在我的项目的 vendor
目录中拥有所有依赖项,但我不想在此目录中手动添加某些内容,因为它是由 Composer 管理的。所以我让作曲家处理一切。