我正试图将本地包加载到我的Laravel 8项目中,但在./composer.json
:中出现以下错误
"./composer.json" does not match the expected JSON schema:
- repositories[5].url : The property url is required
- repositories[5].type : Does not have a value in the enumeration ["composer"]
- repositories[5].type : Does not have a value in the enumeration ["vcs","github","git","gitlab","bitbucket"
,"git-bitbucket","hg","fossil","perforce","svn"]
- repositories[5].type : Does not have a value in the enumeration ["artifact"]
- repositories[5].type : Does not have a value in the enumeration ["pear"]
- repositories[5].package : The property package is required
- repositories[5].type : Does not have a value in the enumeration ["package"]
- repositories[5] : Failed to match at least one schema
- repositories[5] : Must contain no more than 1 properties
- repositories[5].type : String value found, but a boolean is required
- repositories[5].type : Does not have a value in the enumeration [false]
- repositories[5].path : String value found, but a boolean is required
- repositories[5].path : Does not have a value in the enumeration [false]
我的composer.json
文件包含以下用于需求和转发部分的内容:
"repositories": [
{
"type": "vcs",
"url": "git@github.com:company/pkg-fudge-inbound-management-bridge.git"
},
{
"type": "vcs",
"url": "git@github.com:company/pkg-inbound-management.git"
},
{
"type": "vcs",
"url": "git@github.com:company/pkg-blog.git"
},
{
"type": "vcs",
"url": "git@github.com:company/pkg-credit-score.git"
},
{
"type": "vcs",
"url": "git@github.com:company/pkg-policies.git"
},
{
"type": "path",
"path": "/Users/ryanholton/Sites/laravel-packages/pkg-cms"
}
],
"require": {
"php": "^7.3",
"doctrine/dbal": "^2.11",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "8.60.*",
"laravel/tinker": "^2.0",
"company/pkg-fudge-inbound-management-bridge": "1.1.*",
"company/pkg-inbound-management": "2.0.*",
"company/pkg-blog": "1.4.*",
"company/pkg-credit-score": "1.2.*",
"company/pkg-policies": "1.0.*",
"company/pkg-cms": "*"
}
不确定我为什么会出现这个错误,以前从未在本地包中出现过,我缺少什么?
试试这个!
{
"repositories": [
{
"type": "package",
"package": {
"name": "name/example-package",
"version": "dev-master",
"source": {
"url": "git@github.com:company/pkg-policies.git",
"type": "git",
"reference": "dev-master"
}
}
}
]
}
基于文档:https://getcomposer.org/doc/05-repositories.md#path
你需要像这样定义
{
"repositories": [
{
"type": "path",
"url": "/Users/ryanholton/Sites/laravel-packages/pkg-cms"
}
],
}
因此,您似乎只需要用url
替换path
。
正如错误所说,repositories
数组中的最后一个项目应该是:
{
"type": $type,
"url": //here you have to define url
"path": "/Users/ryanholton/Sites/laravel-packages/pkg-cms"
}
并且您的$type
变量应该具有以下值之一:
"vcs","github","git","gitlab","bitbucket" ,"git-bitbucket","hg","fossil","perforce","svn","composer","artifact","pear","package"
如果您正在尝试添加包,那么$type
应该是"package"
。