composer存储库优先级问题

composer存储库repositories可以有多个,默认是按照顺序。

但有时可能会出现因为优先级问题导致的包无法安装,例如想安装一个优先级比较低的源里的包,但是这个包在更高优先级的源里也存在,就会报出如下异常:

Problem 1
- Root composer.json requires xxx/yyy v1.2.3-dev, it is satisfiable by xxx/yyy[v1.2.3-dev] from composer repo (https://a.b.c) but xxx/yyy[v1.1.0, …, v1.2.2] from composer repo (https://z.y.x) has higher repository priority. The packages with higher priority do not match your constraint and are therefore not installable. See https://getcomposer.org/repoprio for details and assistance.

此时,可以按照以下方法解决:

1.在repositories中的https://z.y.x下加入配置"exclude": ["xxx/yyy"],表示忽略这个存储库中的xxx/yyy包。
2.在https://a.b.c下加入配置"only": ["haha/wawa"],表示在这个存储库中只加载xxx/yyy包。

在某些情况下,只做第一步就可以,跳过高优先级的源就能实现目标。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值