简体   繁体   English

通过composer安装Yii2失败

[英]Installing Yii2 via composer failed

I want to install yii2 via composer and it's give me a error 我想通过composer安装yii2,它给了我一个错误

here is error: 这是错误:

  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.

also i installed latest version of composer-asset-plugin. 我也安装了最新版本的composer-asset-plugin。 i cleared composer cache and update it. 我清除了作曲家缓存并更新它。 but i can't install yii2-basic anyway 但我无论如何都无法安装yii2-basic

it's my composer.json 这是我的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": "*"
    }
}

As Yii 2 is bound to the fxp/composer-asset-plugin you have to install the fxp plugin to your composer environment . 由于Yii 2绑定到fxp / composer-asset-plugin,您必须将fxp插件安装到您的composer 环境中 The fxp plugin must be installed globally . 必须全局安装fxp插件。 You can achieve this with the following command: 您可以使用以下命令实现此目的:

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

After sucessfull installation of the fxp plugin remove the requirement from your require section in the composer.json and run composer update again. 成功安装fxp插件后,从composer.json中的require部分删除需求,然后再次运行composer update

How to install FXP composer plugin Docs 如何安装FXP composer插件文档

I had same problem when I run composer update 我运行composer update时遇到了同样的问题

I solved it by install command instead of update 我通过安装命令而不是更新来解决它

composer install

Also you can try to update composer at first 您也可以尝试更新作曲家

composer self-update

You could try yii2-bower-asset without using fxp/composer-asset-plugin to install Bower for Yii2. 您可以尝试使用yii2-bower-asset而不使用fxp/composer-asset-plugin为Yii2安装Bower。

This package has fixed Bower for Yii2, which separates Bower and Composer. 这个包装有固定的Bower for Yii2,它将Bower和Composer分开。

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


By the way, Yii 2.1 is going to use Asset Packagist solution instead of fxp/composer-asset-plugin . 顺便说一句,Yii 2.1将使用Asset Packagist解决方案而不是fxp/composer-asset-plugin

I have solved the problem by following steps. 我通过以下步骤解决了这个问题。

Step 1: Delete th file composer.lock from project folder 步骤1:从项目文件夹中删除文件composer.lock

Step 2: Delete the vendor folder 第2步:删除vendor文件夹

Step 3: Run the command composer global require "fxp/composer-asset-plugin:~1.4" 第3步:运行命令composer global require "fxp/composer-asset-plugin:~1.4"

Step 4: Run composer update 第4步:运行composer update

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM