通过composer安装Yii2失败了

4

我想通过composer安装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。

我清理了composer缓存并更新了它,但无论如何我都无法安装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": "*"
    }
}

重新启动你的系统! - Muhammad Shahzad
尝试运行 composer self update。 - Don Vincent
1
"minimum-stability": "dev" 更改为 "minimum-stability": "stable" - Casimir et Hippolyte
4个回答

16

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

composer global require "fxp/composer-asset-plugin:~1.4"
成功安装fxp插件后,请从composer.json的require部分中删除该要求,并再次运行composer update如何安装FXP composer插件文档

Yii2有望在2.1版本中取消fxp插件的要求,这是我从维基百科的下一个主要版本计划中读到的。 - nadar
我们也可以在本地安装它 php composer.phar require "fxp/composer-asset-plugin:~1.2.2"。顺便说一下,谢谢。 - Aabir Hussain

1

当我运行composer update时遇到了同样的问题。

我通过安装命令而不是更新来解决它。

composer install

同时,您可以首先尝试更新Composer

composer self-update

0

您可以尝试使用yii2-bower-asset来安装Yii2的Bower,而无需使用fxp/composer-asset-plugin

该软件包已经为Yii2固定了Bower,将Bower和Composer分开。

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


顺便提一下,Yii 2.1 将采用 Asset Packagist 解决方案,而不是 fxp/composer-asset-plugin。

0

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

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

步骤2:删除vendor文件夹

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

步骤4:运行composer update


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接