在任何版本中都找不到Composer包

时间:2015-12-30 07:11:44

标签: github version-control composer-php packagist

我正在尝试创建自定义供应商包但尚未将包放在packagist上。根据文档,包可以从git(vcs)而不是packagist加载:https://getcomposer.org/doc/05-repositories.md#loading-a-package-from-a-vcs-repository

yii2项目(虽然不认为框架很重要)我在供应商文件夹中创建了包:

foundationize / yii2-基础 (文件夹结构如上,我有四重检查)。

我的root public_html / composer.json有以下条目:

{
    "name": "foundationize/yii2-foundation",
    "description": "The Foundation extension for the Yii2 framework",
    "keywords": ["yii2", "foundation"],
    "type": "yii2-extension",
    "license": "BSD-3-Clause",
    "support": {
        "issues": "https://github.com/foundationize/yii2-foundation/issues",
        "wiki": "https://github.com/foundationize/yii2-foundation/wiki",
        "source": "https://github.com/foundationize/yii2-foundation.git"
    },
    "authors": [
        {
            "name": "gvanto",
            "email": "gvanto@hotmail.com",
            "homepage": "http://foundationize.com"
        }
    ],
    "require": {
        "yiisoft/yii2": "*"
    },
    "autoload": {
        "psr-4": {
            "foundationize\\foundation\\": ""
        }
    },
    "repositories": [
        {
            "packagist": false,
            "type": "vcs",
            "url": "https://github.com/foundationize/yii2-foundation.git"           
        }
    ]       
}

我的包编写器文件,vendor / foundationize / yii2-foundation / composer.json看起来像:

plot "data.txt" u ((strptime("%Y-%m-%d",strcol(1))-strptime("%Y-%m-%d","2015-12-10"))/86400.0):2

当我运行composer install(或更新)时,我不断收到以下错误:

  

您的要求无法解析为可安装的一组   包。

     

问题1        - 在任何版本中都找不到所请求的包basicize / yii2-foundation,包名中可能有拼写错误。

     

潜在原因:     - 包名中的拼写错误     - 根据您的最小稳定性设置,该包装没有足够稳定的版本   https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion   了解更多详情。

     

阅读https://getcomposer.org/doc/articles/troubleshooting.md   进一步的常见问题。

我已经搜索了它的高低,阅读文档似乎无法使其工作(总是相同的错误,我认为如果它说找不到包或者找到了错误的软件包版本。)

我错过了一些基本的东西吗? : - (

非常感谢 gvanto

3 个答案:

答案 0 :(得分:3)

您必须将repositories条目添加到根composer.json文件中。否则,Composer不知道在哪里搜索您的包。

答案 1 :(得分:0)

由于Laravel 5.5版具有程序包自动发现功能,因此无需添加服务提供商。您需要像这样注册软件包:

  

作曲家需要barryvdh / laravel-debugbar:dev-master

您可以在这些文章中找到更多信息:

https://medium.com/@taylorotwell/package-auto-discovery-in-laravel-5-5-ea9e3ab20518 https://divinglaravel.com/laravels-package-auto-discovery

答案 2 :(得分:0)

有类似的问题,这是因为我在新的Drupal结构的/ web目录中运行composer。当我在根中运行它时,一切都很好。烦人的是,您需要在/ web中运行Drush