dtf579777 2019-07-23 12:47
浏览 633
已采纳

如何在Composer中强制依赖库的版本

I have a composer.json which contains library nette/nette which has dependence to other library nette/deprecated and this nested library has a bug in newer version. So I need to force Composer to load previous version of nested library nette/deprecated. The problem is that the main library nette/nette need s to be of version "nette/nette": "~2.4.0" but all the 2.4 and also 2.5 versions depends on the buggy nette/deprecated library. How to force Composer to load exactly required version of nested nette/deprecated library? It seems it is not possible or I am not enough educated in Composer features. Thanks.

  • 写回答

1条回答 默认 最新

  • dongxi1320 2019-07-24 08:36
    关注

    If you know that a dependency has a bug or interferes with something in your code you can mark it as conflicting in your composer.json.

    {
        "...",
        "require": {
            "..."
        },
        "conflict": {
            "nette/deprecated": ">2.4.0,<3.0.0"
        }
    }
    

    This will exclude everything after 2.4.0 and smaller than 3.0.0, but you can change the value to whatever you need it to be. This way you can communicate clearly, that there are certain versions that are off limits without explicitly declaring this as a root dependency.

    See also: https://getcomposer.org/doc/04-schema.md#conflict

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 yolov8边框坐标
  • ¥15 matlab中使用gurobi时报错
  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真