【发布时间】:2016-06-13 11:08:35
【问题描述】:
我正在做一个项目,最后不得不对我正在使用的一个包进行一些小改动。
那个包是:shopifyextras/shopify-php-api-wrapper
你可以在这里找到:https://github.com/ShopifyExtras/PHP-Shopify-API-Wrapper
我之前的 composer.json 文件是这样的:
{
"require": {
"monolog/monolog": "1.*",
"shopifyextras/shopify-php-api-wrapper": "^1.1"
},
"autoload": {
"psr-0": { "MyApp\\": "src/" }
}
}
在 fork 存储库并进行更改之后(我忘了先创建一个新分支,但在提交到 master 后创建了分支,并将其推送到 github - 我认为这不会导致任何问题,因为分支存在并且它确实指向正确的头部),然后我更新了我的 composer.json 以使用我的 fork。
阅读作曲家文档 (https://getcomposer.org/doc/05-repositories.md#vcs) 后,我将 composer.json 更新为以下内容:
{
"minimum-stability": "dev",
"prefer-stable" : true,
"repositories": [
{
"type": "git",
"url": "https://github.com/JonLaliberte/PHP-Shopify-API-Wrapper.git"
}
],
"require": {
"monolog/monolog": "1.*",
"shopifyextras/shopify-php-api-wrapper": "dev-risksbugfix"
},
"autoload": {
"psr-0": { "MyApp\\": "src/" }
}
}
当我运行 composer update 时,我收到以下错误:
$ composer update --verbose
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 shopifyextras/shopify-php-api-wrapper could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
我试过了:
使用“risksbugfix”而不是“dev-risksbugfix”
使用类型“vcs”而不是 git“
从 repo URL 中删除“.git”
使用“jonlaliberte/shopify-php-api-wrapper”而不是“shopifyextras/shopify-php-api-wrapper”
任何帮助将不胜感激。谢谢!
【问题讨论】:
-
尝试使用
dev-master而不是dev-risksbugfix,同时保持手册中提到的repositories配置 -
"dev-
" 和存储库的正确 URI(最后带有 .git)应该可以解决问题。也许是因为您的分支名称正是“dev-riskbugfix”而不仅仅是“riskbugfix”? -
@codeHeart 好的,成功了,谢谢!我有点困惑为什么另一个分支不起作用?该手册说要使用一个单独的分支(无论如何我应该从一开始就这样做),并按照问题描述中提到的方式(
dev-<branchname>)引用它。使用私有仓库时似乎只引用dev-master。 -
还要注意@paskl 的评论,所以也许你需要做
dev-dev-riskbugfix或将你的分支名称更改为riskbugfix
标签: php git composer-php