通过composer安装Yii2失败

时间:2016-09-04 08:56:48

标签: php yii yii2 composer-php yii2-basic-app

我想通过作曲家安装yii2并且它给我一个错误

这是错误:

  Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - yiisoft/yii2 2.0.9 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.8 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.7 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.6 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.5 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - Installation request for yiisoft/yii2 >=2.0.5 -> satisfiable by yiisoft/yii2[2.0.5, 2.0.6, 2.0.7, 2.0.8, 2.0.9].

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 <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

我也安装了最新版本的composer-asset-plugin。 我清除了作曲家缓存并更新它。 但我无论如何都无法安装yii2-basic

它是我的composer.json

{
    "require": {
        "phpunit/phpunit": "*",
        "phpunit/phpunit-selenium": "*",
        "phpunit/php-invoker": "^1.1",
        "phpunit/dbunit" : "^2.0",
        "fxp/composer-asset-plugin": "^1.2.0"
    },
    "minimum-stablility‬‬": "dev",
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/Codeception/YiiBridge",
            "reference": "origin/master"
        }
    ],
    "require-dev": {
        "codeception/codeception": "2.2.2",
        "codeception/YiiBridge": "dev-master",
        "flow/jsonpath": "*"
    }
}

4 个答案:

答案 0 :(得分:12)

由于Yii 2绑定到fxp/composer-asset-plugin,您必须将fxp插件安装到您的composer 环境。必须安装fxp插件全局。您可以使用以下命令实现此目的:

composer global require "fxp/composer-asset-plugin:~1.4"

成功安装fxp插件后,请删除composer.json中 require 部分的要求,然后再次运行composer update

How to install FXP composer plugin Docs

答案 1 :(得分:0)

运行composer update

时遇到同样的问题

我通过安装命令而不是更新

解决了这个问题
composer install

您也可以尝试首先更新作曲家

composer self-update

答案 2 :(得分:0)

您可以尝试yii2-bower-asset而不使用fxp/composer-asset-plugin为Yii2安装Bower。

这个软件包固定了Bower for Yii2,它将Bower和Composer分开。

  

https://github.com/yidas/yii2-bower-asset

顺便说一句,Yii 2.1将使用Asset Packagist解决方案而不是fxp/composer-asset-plugin

答案 3 :(得分:0)

我已按照以下步骤解决了问题。

步骤1:从项目文件夹中删除文件composer.lock

第2步:删除vendor文件夹

步骤3:运行命令composer global require "fxp/composer-asset-plugin:~1.4"

第4步:运行composer update