gpt4 book ai didi

symfony - Composer 不会安装私有(private)包依赖项

转载 作者:行者123 更新时间:2023-12-03 22:15:24 25 4
gpt4 key购买 nike

首先,有一些相关的帖子并不真正适合我的问题。

  • Composer won't install dependency
  • Composer not installing local package dependencies
  • Composer not installing dependencies of Package

  • 还有更多。

    我有一个包含一些私有(private)包的 Symfony 项目。
    这些被 vcs 引用:
    "repositories": [
    {
    "type": "vcs",
    "url": "git@aaaaa.git"
    },
    {
    "type": "vcs",
    "url": "git@xxxxx.git"
    },
    {
    "type": "vcs",
    "url": "git@yyyyy.git"
    }
    ],

    这像预期的那样工作。但是,私有(private)包 yyyy 引用了另一个私有(private)包(我们称之为 sub-yyyy),该私有(private)包也被包 composer.json 文件中的 vcs 类型引用。

    如果我运行 composer install 它失败并显示以下消息:

    Problem 1 - Installation request for yyyy -> yyyy]. - yyyy requires sub-yyyy ^1.0.0 -> no matching package found.

    Potential causes:



    私有(private)包(子 yyyy)是由 v1.0.0 标记的,如果它在主项目的 composer.json 文件中,则可以安装。

    主项目的composer.json(需要剪掉):
    {
    "name": "main/project",
    "license": "proprietary",
    "type": "project",
    "prefer-stable": true,
    "repositories": [
    {
    "type": "vcs",
    "url": "git@aaaaa.git"
    },
    {
    "type": "vcs",
    "url": "git@xxxxx.git"
    },
    {
    "type": "vcs",
    "url": "git@yyyyy.git"
    }
    ],
    }

    yyyy包的composer.json:
    {
    "name": "yyyy",
    "type": "symfony-bundle",

    "require": {
    "sub-yyyy": "^1.0.0"
    },

    "repositories": [
    {
    "type": "vcs",
    "url": "git@sub-yyyy.git"
    }
    ],
    "minimum-stability": "dev",
    }

    安装 yyyy 时解决问题的任何想法引用 sub-yyyy 的包?

    最佳答案

    您必须将存储库条目添加到包 sub-yyyy在您的主项目中,因为依赖项条目是不可传递的。

    来自 docs

    Repositories are not resolved recursively. You can only add them to your main composer.json. Repository declarations of dependencies' composer.jsons are ignored.



    您的 composer.json主要项目应该看起来像
    {
    "name": "main/project",
    "license": "proprietary",
    "type": "project",
    "prefer-stable": true,
    "repositories": [
    {
    "type": "vcs",
    "url": "git@aaaaa.git"
    },
    {
    "type": "vcs",
    "url": "git@xxxxx.git"
    },
    {
    "type": "vcs",
    "url": "git@yyyyy.git"
    },
    {
    "type": "vcs",
    "url": "git@sub-yyyy.git"
    }
    ]
    }

    关于symfony - Composer 不会安装私有(private)包依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51355985/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com