laravel Composer Fatal error: Declaration of Fxp... must be compatible with ...AbstractAssetsRepository.php on line 334

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37955880/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 14:03:05  来源:igfitidea点击:

Composer Fatal error: Declaration of Fxp... must be compatible with ...AbstractAssetsRepository.php on line 334

phplinuxlaravelcommand-linecomposer-php

提问by Arthur Hovasap

I updated composer

我更新了作曲家

composer self-update

I installed the newer version of the plugin

我安装了较新版本的插件

composer global require "fxp/composer-asset-plugin:*"

I try to install Laravel

我尝试安装 Laravel

composer global require "laravel/installer"

composer global 需要“laravel/installer”

Changed current directory to C:/Users/Arthur/AppData/Roaming/Composer    
Fatal error: Declaration of Fxp\Composer\AssetPlugin\Repository\AbstractAssetsRe
    pository::search() must be compatible with Composer\Repository\RepositoryInterfa
    ce::search($query, $mode = 0, $type = NULL) in C:\Users\Arthur\AppData\Roaming\C
    omposer\vendor\fxp\composer-asset-plugin\Repository\AbstractAssetsRepository.php
     on line 334

Now all commands in composer not working

现在作曲家中的所有命令都不起作用

composer <any command>

Please help me to resolve it

请帮我解决

回答by ShiraNai7

You can temporarily disable composer plugins with the --no-pluginsoption:

您可以使用以下--no-plugins选项暂时禁用 Composer 插件:

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

See Composer docs - Global options:

请参阅 Composer 文档 -全局选项

--no-plugins: Disables plugins.

--no-plugins:禁用插件。

回答by Arthur Hovasap

To solve the above error while installing composer asset plugin please do the following

要在安装 composer 资产插件时解决上述错误,请执行以下操作

  1. delete fxp folder in the path C:\Users\UserName\AppData\Roaming\Composer\vendor

  2. remove "fxp/composer-asset-plugin": "^1.4"from composer.json file in composer folder

  3. run this command composer global remove fxp/composer-asset-plugin --no-pluginsto make sure no fxp folder is left and json data

  4. composer global require fxp/composer-asset-plugin --no-pluginsRun this command to install composer asset plugin and it will be installed easily

  5. If you want to update existing plugin, run this command

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

  1. 删除路径 C:\Users\UserName\AppData\Roaming\Composer\vendor 中的 fxp 文件夹

  2. "fxp/composer-asset-plugin": "^1.4"从 composer 文件夹中的 composer.json 文件中删除

  3. 运行此命令 composer global remove fxp/composer-asset-plugin --no-plugins以确保没有留下 fxp 文件夹和 json 数据

  4. composer global require fxp/composer-asset-plugin --no-plugins运行这个命令来安装 composer 资产插件,它会很容易安装

  5. 如果要更新现有插件,请运行此命令

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

回答by Abdallah Awwad Alkhwaldah

according to this decision here

根据这里的决定

composer error when run composer update

运行 composer update 时出现 composer 错误

rm -rf ~/.composer/vendor/fxp