来自自己的分叉存储库的Composer依赖性 [英] Composer dependency from own forked repository

查看:126
本文介绍了来自自己的分叉存储库的Composer依赖性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有gitlab存储库 https://gitlab.com/ajkosh/yii2-admin 下面是我的 composer.json

I have gitlab repository https://gitlab.com/ajkosh/yii2-admin and below is my composer.json:

{
    "name": "haruatari/yii2-module-app",
    "description": "Empty module application on Yii2",
    "minimum-stability": "stable",
    "license": "MIT",
    "authors": [
        {
            "name": "Viktor Pikaev",
            "email": "haruatari@gmail.com",
            "homepage": "http://haru-atari.com/about"
        }
    ],
    "repositories": [
        {
            "type": "vcs",
            "url": "git@github.com:ajkosh/yii2-admin.git"
        }

    ],
    "require": {
         "php": ">=5.4.0",
        "yiisoft/yii2": "2.0.15",
        "yiisoft/yii2-bootstrap": "~2.0.0",
        "yiisoft/yii2-swiftmailer": "~2.0.0",
        "paulzi/yii2-materialized-path": "^2.0",
        "kartik-v/yii2-widget-select2":"2.0.4",
        "ajkosh/yii2-admin": "dev"
    },
    "require-dev": {
      "codeception/codeception": "*",
        "yiisoft/yii2-debug": "*",
        "yiisoft/yii2-gii": "*",
        "yiisoft/yii2-faker": "*"
    },
    "config": {
    "fxp-asset": {
      "installer-paths": {
        "npm-asset-library": "vendor/npm",
        "bower-asset-library": "vendor/bower"
      }
    },
    "process-timeout": 1800},
    "scripts": {
        "post-create-project-cmd": [
            "yii\\composer\\Installer::postCreateProject"
        ]
    },
    "extra": {
        "yii\\composer\\Installer::postCreateProject": {
            "setPermission": [
                {
                    "runtime": "0777",
                    "web/assets": "0777",
                    "data": "0777",
                    "data/log": "0777",
                    "data/tmp": "0777",
                    "yii": "0755"
                }
            ],
            "generateCookieValidationKey": [
                "config/web.php"
            ]
        }
    }
}

我正在尝试从自己的存储库中获取 yii2-admin ,但是运行时出现错误提示

I am trying to fetch yii2-admin from my own repository but I am getting below error when I am running composer update.


 Problem 1
    - The requested package ajkosh/yii2-admin 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.
 - It's a private package and you forgot to add a custom repository to find it

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.



推荐答案

使用不正确的软件包名称。解决URL中的依赖项包名称无关紧要,唯一重要的名称是 composer.json 中的包名称。因此,Composer从您的composer.json nofollow noreferrer>分叉的存储库,并找到名称 mdmsoft / yii2-admin ,因为您在分叉后没有更改它。根本没有 ajkosh / yii2-admin 。您应该在叉子中的 composer.json 中更新软件包名称:

You're using incorrect package name. On resolving dependencies package name in URL is irrelevant, the only name what matters is package name in composer.json. So Composer reads composer.json from your forked repository, and finds name mdmsoft/yii2-admin, because you don't changed it after forking. There is no ajkosh/yii2-admin at all. You should either update package name in composer.json in your fork:

{
    "name": "ajkosh/yii2-admin",
    "description": "RBAC Auth manager for Yii2 ",
    "keywords": ["yii", "admin", "auth", "rbac"],
    "type": "yii2-extension",
    ...

在您的需求部分中使用源软件包名称:

Or use source package name in your require section:

"require": {
    ...
    "mdmsoft/yii2-admin": "dev-master"
},

这篇关于来自自己的分叉存储库的Composer依赖性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆