问题描述
我最近为 Yii2 基本应用程序模板运行了最新的 composer 安装.
I recently ran latest composer installation for a Yii2 basic application template.
但是运行 php composer.phar install
会抛出这个异常:
But running php composer.phar install
throws this exception:
Class FxpComposerAssetPluginRepositoryNpmRepository 没有存在
yiisoft/yii2-composer"插件需要 composer-plugin-api 1.0.0,这个 WIL L 将来会中断,应该尽快修复(需要例如^1.0).
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] 类FxpComposerAssetPluginRepositoryNpmRepository 不存在
[ReflectionException] Class FxpComposerAssetPluginRepositoryNpmRepository does not exist
[错误异常]
声明FxpComposerAssetPluginRepositoryAbstractAssetsRepository::whatProvides() 应该与ComposerRepositoryComposerRepository::whatProvides(ComposerDependencyResolverPool $pool, $name,$bypassFilters = 假)
Declaration of FxpComposerAssetPluginRepositoryAbstractAssetsRepository::w hatProvides() should be compatible with ComposerRepositoryComposerRepository:: whatProvides(ComposerDependencyResolverPool $pool, $name, $bypassFilters = fal se)
这是我的 composer.json:
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?
推荐答案
如错误信息所说:
"yiisoft/yii2-composer" 插件需要 composer-plugin-api 1.0.0,这将在未来打破,应该尽快修复(例如需要 ^1.0).
尝试更新您的fxp/composer-asset-plugin
:
php composer.phar 全局更新 fxp/composer-asset-plugin --no-plugins
PS:如果更新后仍然无法正常工作,请尝试以下操作:
PS: If after update it still not working, try also following:
composer global require fxp/composer-asset-plugin --no-plugins
这篇关于更新 composer 抛出异常 Class FxpComposerAssetPluginRepositoryNpmRepository 不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!