我已经分叉了一个仓库,并创建了一个名为3.0的分支,我希望将其安装到我的项目中进行测试(不是长期派生。我想在测试后创建一个请求请求)。我已将以下内容添加到我的作曲家文件中:
"repositories": [{
"type": "vcs",
"url": "https://github.com/albertski/laravel-grid"
}],
运行composer show "albertski/laravel-grid"
时得到Package albertski/laravel-grid not found
。
运行composer require albertski/laravel-grid:3
.0-dev
时,我得到以下信息:
Could not find a matching version of package albertski/laravel-grid. Check
the package spelling, your version constraint and that the package is avail
able in a stability which matches your minimum-stability (dev).
我缺少任何步骤吗?根据{{3}},应该是这样。我正在使用Composer 1.9.0版。
这是我完整的composer.json文件:
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2",
"fideloper/proxy": "^4.0",
"laravel/browser-kit-testing": "^5.1",
"laravel/framework": "^6.0",
"laravel/tinker": "^1.0",
"laravel/ui": "^1.0"
},
"require-dev": {
"facade/ignition": "^1.4",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^8.0"
},
"repositories": [{
"type": "vcs",
"url": "https://github.com/albertski/laravel-grid"
}],
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
},
"files": ["tests/utilities/functions.php"]
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
}
}
修改
为了进行测试,我创建了一个名为3.0_albert
的分支,并将composer.json名称字段更新为"name": "albertski/laravel-grid",
。 (不喜欢这样做,因为我最终想执行拉取请求)
然后运行了composer require albertski/laravel-grid:3.0_albert-dev
,但问题相同。
答案 0 :(得分:0)
我能够弄清楚。而不是调用:
composer require albertski/laravel-grid:3.0.x-dev
您致电:
composer require leantony/laravel-grid:3.0.x-dev
基本上通过添加:
"repositories": [{
"type": "vcs",
"url": "https://github.com/albertski/laravel-grid"
}],
您要告诉作曲家首先检查软件包的仓库,而不是默认的仓库。