Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I recently ran latest composer installation for a Yii2 basic application template.

But running php composer.phar install throws this exception:

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 = fal se)

Here is my composer.json:

{
    "name": "yiisoft/yii2-app-basic",
    "description": "Yii 2 Basic Project Template",
    "keywords": ["yii2", "framework", "basic", "project template"],
    "homepage": "http://www.yiiframework.com/",
    "type": "project",
    "license": "BSD-3-Clause",
    "support": {
        "issues": "https://github.com/yiisoft/yii2/issues?state=open",
        "forum": "http://www.yiiframework.com/forum/",
        "wiki": "http://www.yiiframework.com/wiki/",
        "irc": "irc://irc.freenode.net/yii",
        "source": "https://github.com/yiisoft/yii2"
    },
    "minimum-stability": "stable",
    "require": {
        "php": ">=5.4.0",
        "yiisoft/yii2": ">=2.0.5",
        "yiisoft/yii2-bootstrap": "*",
        "yiisoft/yii2-swiftmailer": "*"

    },
    "require-dev": {
        "yiisoft/yii2-codeception": "*",
        "yiisoft/yii2-debug": "*",
        "yiisoft/yii2-gii": "*",
        "yiisoft/yii2-faker": "*"
    },
    "config": {
        "process-timeout": 1800
    },
    "scripts": {
        "post-create-project-cmd": [
            "yii\\composer\\Installer::postCreateProject"
        ]
    },
    "extra": {
        "yii\\composer\\Installer::postCreateProject": {
            "setPermission": [
                {
                    "runtime": "0777",
                    "web/assets": "0777",
                    "yii": "0755"
                }
            ],
            "generateCookieValidationKey": [
                "config/web.php"
            ]
        },
        "asset-installer-paths": {
            "npm-asset-library": "vendor/npm",
            "bower-asset-library": "vendor/bower"
        }
    }
}

What could have gone wrong? Anyone experiencing this?

like image 852
Ramesh Pareek Avatar asked Apr 12 '16 16:04

Ramesh Pareek


1 Answers

Like the error message says:

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

Try to update your fxp/composer-asset-plugin:

php composer.phar global update fxp/composer-asset-plugin --no-plugins

PS: If after update it still not working, try also following:

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

like image 170
Bfcm Avatar answered Dec 25 '22 12:12

Bfcm