Updating composer throws exception Class Fxp\Composer\AssetPlugin\Repository\NpmRepository does not exist

Class Fxp\Composer\AssetPlugin\Repository\NpmRepository does not exist

The “yiisoft/yii2-composer” plugin requires composer-plugin-api 1.0.0, this WIL L break in the future and it should be fixed ASAP (require ^1.0 for example).

[ReflectionException] Class Fxp\Composer\AssetPlugin\Repository\NpmRepository does not exist

[ErrorException]

Declaration of Fxp\Composer\AssetPlugin\Repository\AbstractAssetsRepository::w hatProvides() should be compatible with Composer\Repository\ComposerRepository:: whatProvides(Composer\DependencyResolver\Pool $pool, $name, $bypassFilters = false)

解决方法:

composer global require fxp/composer-asset-plugin –no-plugins