更新composer抛出异常类Fxp \ Composer \ AssetPlugin \ Repository \ NpmRepository不存在

时间:2016-04-12 16:54:42

标签: yii2 composer-php

我最近为Yii2基本应用程序模板运行了最新的作曲家安装。

但是运行php composer.phar install会抛出此异常:

  

类Fxp \ Composer \ AssetPlugin \ Repository \ NpmRepository没有   存在

     

" yiisoft / yii2-composer"插件需要composer-plugin-api 1.0.0,   这个 WIL L 将来会中断,应该尽快修复(要求   例如^ 1.0。

     

[ReflectionException]类   Fxp \ Composer \ AssetPlugin \ Repository \ NpmRepository不存在

     

[ErrorException]

     

宣言   FXP \作曲\ AssetPlugin \库\ AbstractAssetsRepository :: w ^   hatProvides()应该兼容   作曲家\库\ ComposerRepository ::   whatProvides(Composer \ DependencyResolver \ Pool $ pool,$ name,   $ bypassFilters = fal se)

这是我的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"
        }
    }
}

可能出了什么问题?有没有遇到过这个?

1 个答案:

答案 0 :(得分:53)

如错误消息所示:

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).

尝试更新fxp/composer-asset-plugin

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

PS:如果更新后仍无法正常工作,请尝试以下操作:

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