我用别人的 fork ( https://github.com/digital-bird/LaravelShoppingcart ) 做了我的 fork ( https://github.com/hardevine/LaravelShoppingcart )。
我想在我的 Laravel 项目中使用我的分支 + 我想在未来修改它。
1) 我通过 composer remove hardevine/shoppingcart
从这个项目中删除了 hardevine 的 fork
2) 然后我修改了 fork 中的 composer.json
:
- 新名称:
"name": "digital-bird/shoppingcart",
- 新作者
- 在要求下我添加了:
"hardevine/shoppingcart": "dev-master",
- 最后我添加了存储库部分:
⬇️
"repositories": [
{
"type": "vcs",
"url": "https://github.com/digital-bird/LaravelShoppingcart"
}
],
我的 fork 的新 package.json
看起来像:https://github.com/digital-bird/LaravelShoppingcart/blob/master/composer.json
3) 我将其推送到我的 fork 的 master 分支
4) 我进入我的 Laravel 项目并输入:
composer require digital-bird/shoppingcart
我遇到了大红色错误:
[InvalidArgumentException] Could not find a matching version of package digital-bird/shoppingcart. Check the package spelling, your version constraint and that the package is ava ilable in a stability which matches your minimum-stability (stable).
我做错了什么?
最佳答案
你应该添加这个:
"repositories": [
{
"type": "vcs",
"url": "https://github.com/digital-bird/LaravelShoppingcart"
}
],
到你的主要 Laravel 项目的 composer.json
而不是你的库。另外添加 "hardevine/shoppingcart": "dev-master",
似乎毫无意义,可能会产生一些冲突。
关于php - 无法在我的 Laravel 项目中使用分支存储库 - "Could not find a matching version of package",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56453369/