我有 gitlab 存储库 https://gitlab.com/ajkosh/yii2-admin下面是我的 composer.json
:
{
"name": "haruatari/yii2-module-app",
"description": "Empty module application on Yii2",
"minimum-stability": "stable",
"license": "MIT",
"authors": [
{
"name": "Viktor Pikaev",
"email": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ee868f9c9b8f9a8f9c87ae89838f8782c08d8183" rel="noreferrer noopener nofollow">[email protected]</a>",
"homepage": "http://haru-atari.com/about"
}
],
"repositories": [
{
"type": "vcs",
"url": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="24434d5064434d504c51460a474b49" rel="noreferrer noopener nofollow">[email protected]</a>: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
,但是当我运行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 从您的 forked repository 读取 composer.json
,并找到名称 mdmsoft/yii2-admin
,因为您在 fork 后没有更改它。根本没有ajkosh/yii2-admin
。您应该在您的 fork 中更新 composer.json
中的包名称:
{
"name": "ajkosh/yii2-admin",
"description": "RBAC Auth manager for Yii2 ",
"keywords": ["yii", "admin", "auth", "rbac"],
"type": "yii2-extension",
...
或者在 require
部分中使用源包名称:
"require": {
...
"mdmsoft/yii2-admin": "dev-master"
},
关于yii2 - Composer 依赖于自己的 fork 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50732607/