无法使用composer安装phpunit

时间:2013-07-09 13:05:43

标签: phpunit local composer-php

基本上我有这个composer.json文件:

{
    "name": "phpunit/phpunit",
    "require": {
        "phpunit/phpunit": "3.8.*@dev"
    },
    "authors": [
        {
            "name": "Sebastian Bergmann",
            "email": "sebastian@phpunit.de"
        }
    ]
}

当我去运行“composer install”时,我收到以下错误:

Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for phpunit/phpunit 3.8.*@dev -> satisfiable by phpunit/phpunit[3.8.x-dev].
    - phpunit/phpunit 3.8.x-dev requires phpunit/php-code-coverage 1.3.*@dev -> no matching package found.

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://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

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

我不知道这意味着什么?谢谢

1 个答案:

答案 0 :(得分:4)

在真正回答你的问题之前:

您已调用项目phpunit/phpunit,并且phpunit/phpunit上有一项要求。这是循环依赖。你应该把你的项目称为别的东西。

另外,我怀疑你是“Sebastian Bergmann”,所以你应该在作曲家文件中更改作者姓名和电子邮件地址。

好的,对于您的实际问题,默认情况下,Composer不会安装开发包。您需要通过放置

明确告诉它安装dev包

“最小稳定性”:“dev”

在项目的根composer.json文件中,或者将PHPUnit的require更改为不使用dev包,例如。

"require": {
    "phpunit/phpunit": "3.8.*"
},

除非您正在主动调试另一个程序包中的问题,否则您实际上不太可能想要使用该程序包的开发版本。你几乎总是想要一个真正的标记版本。