Php 通过composer安装Yii2失败

Php 通过composer安装Yii2失败,php,yii,yii2,composer-php,yii2-basic-app,Php,Yii,Yii2,Composer Php,Yii2 Basic App,我想通过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 ma

我想通过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.
由于Yii 2绑定到,您必须将fxp插件安装到您的composer环境中。fxp插件必须在全球范围内安装。您可以使用以下命令来实现这一点:

composer global require "fxp/composer-asset-plugin:~1.4"
成功安装fxp插件后,从composer.json中的require部分删除需求,然后再次运行
composer update


我在运行
composer update

我通过安装命令而不是更新解决了这个问题

composer install
此外,您还可以尝试首先更新composer

composer self-update
您可以尝试在不使用
fxp/composer资产插件的情况下安装Bower for Yii2

该软件包为Yii2提供了固定的Bower,将Bower和Composer分开



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

我通过以下步骤解决了问题

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

步骤2:删除
供应商
文件夹

步骤3:运行命令
composer global require“fxp/composer资产插件:~1.4”


步骤4:运行
composer update

重新启动系统!尝试运行composer自更新更改
“最小稳定性‬‬": "dev“
”最小稳定性‬‬": "stable“
Yii2有望在版本2.1中放弃fxp插件要求,正如我可以从wiki中的中读到的那样。我们也可以在本地安装它
php composer.phar require“fxp/composer资产插件:~1.2.2”
。顺便说一句,谢谢
composer self-update