4

I want to install yii2 via composer and it's give me a error

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. i cleared composer cache and update it. but i can't install yii2-basic anyway

it's my 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": "*"
    }
}
RezaGM
  • 66
  • 1
  • 5

4 Answers4

16

As Yii 2 is bound to the fxp/composer-asset-plugin you have to install the fxp plugin to your composer environment. The fxp plugin must be installed globally. 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.

How to install FXP composer plugin Docs

nadar
  • 1,008
  • 11
  • 15
  • Yii2 will hopefully drop the fxp plugin requirement with version 2.1 as i could read from the [next major version plans](https://github.com/yiisoft/yii2/wiki/Plan-for-next-major-versions#client-side) in the wiki. – nadar Sep 04 '16 at 11:51
  • we can also install it locally `php composer.phar require "fxp/composer-asset-plugin:~1.2.2"` . BTW thanks – Aabir Hussain Dec 08 '16 at 05:41
1

I had same problem when I run 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
Alexey Muravyov
  • 1,106
  • 13
  • 17
0

You could try yii2-bower-asset without using fxp/composer-asset-plugin to install Bower for Yii2.

This package has fixed Bower for Yii2, which separates Bower and Composer.

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.

Nick Tsai
  • 3,799
  • 33
  • 36
0

I have solved the problem by following steps.

Step 1: Delete th file composer.lock from project folder

Step 2: Delete the vendor folder

Step 3: Run the command composer global require "fxp/composer-asset-plugin:~1.4"

Step 4: Run composer update

Santi
  • 620
  • 8
  • 22