0

Every time when i try to install some package via composer in yii2. I have error like in picture.

picture

How can i fix this? Help me please!

4 Answers4

2

Upgrade fxp/composer-asset-plugin to latest version (1.2.1) and composer to latest version (1.2.0).

composer global require "fxp/composer-asset-plugin:^1.2.0"
composer selfupdate
Bizley
  • 15,937
  • 5
  • 43
  • 53
  • I have the same problems. C:\xampp\htdocs\basic>composer global require "fxp/composer-asset-plugin:^1.2.0" Changed current directory to C:/Users/Sawyer/AppData/Roaming/Composer Deprecation Notice: The Composer\Package\LinkConstraint\MultiConstraint class is deprecated, use Composer\Semver\Constraint\MultiConstraint instead. in phar://C :/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Package/LinkConstrain t/MultiConstraint.php:17 – Ildar Nasurlaev Aug 05 '16 at 08:12
  • Deprecation Notice: The Composer\Package\LinkConstraint\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface inst ead. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Packa ge/LinkConstraint/LinkConstraintInterface.php:17 [ReflectionException] Class Fxp\Composer\AssetPlugin\Repository\NpmRepository does not exist [ErrorException] – Ildar Nasurlaev Aug 05 '16 at 08:14
  • Declaration of Fxp\Composer\AssetPlugin\Repository\AbstractAssetsRepository ::whatProvides() should be compatible with Composer\Repository\ComposerRepo sitory::whatProvides(Composer\DependencyResolver\Pool $pool, $name, $bypass Filters = false) global []... C:\xampp\htdocs\basic> – Ildar Nasurlaev Aug 05 '16 at 08:14
  • 1
    Try `composer selfupdate` first. If it's not working remove the fxp plugin then update composer and then add fxp again. – Bizley Aug 05 '16 at 08:43
1

Try this and then try to install packages

  php composer.phar global update fxp/composer-asset-plugin --no-plugins
vijay nathji
  • 1,490
  • 11
  • 22
  • I try it and got. C:\xampp\htdocs>php composer.phar global update fxp/composer-asset-plugin --no-p lugins Changed current directory to C:/Users/Sawyer/AppData/Roaming/Composer Loading composer repositories with package information Updating dependencies (including require-dev) Nothing to install or update Generating autoload files C:\xampp\htdocs> composer.phar(only composer work) doesn't work in directory of my project thus i try it in htdocs – Ildar Nasurlaev Aug 05 '16 at 08:10
  • 1
    Follow this link .. Might be helpful to you.. http://stackoverflow.com/questions/36437837/composer-throws-reflectionexception-class-fxp-composer-assetplugin-repository?rq=1 – vijay nathji Aug 05 '16 at 08:37
1

json file in your localhost and put your code in that

and then run command line and go to the composer.json directory

and then write composer init then cmd help you to continue the way

arash rahimi
  • 65
  • 12
0

Thank you all for your advising! Compouser didn't accept any command the problem above had appear always. I think the problem appear after that i had change php.ini file. Problem solved by reinstaling Compouser and Xampp