Composer需要致命错误:Uncaught ArgumentCountError: array_merge()不接受



我正试图为我的laravel应用程序添加身份验证。由于make:auth已被弃用,我尝试了ui:auth和breeze。我是否需要升级我的作曲器?它的版本是1.10.1。当我使用命令行安装时,尽管最新版本是2.5.1。

然而,composer require laravel/breeze:1.9.2composer require laravel/ui

产生以下错误:

Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/
Info from https://repo.packagist.org: #StandWithUkraine
Using version ^4.1 for laravel/ui
./composer.json has been updated
PHP Fatal error:  Uncaught ArgumentCountError: array_merge() does not accept unknown named parameters in /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php:84
Stack trace:
#0 [internal function]: array_merge()
#1 /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php(84): call_user_func_array()
#2 /usr/share/php/Composer/DependencyResolver/Solver.php(387): ComposerDependencyResolverDefaultPolicy->selectPreferredPackages()
#3 /usr/share/php/Composer/DependencyResolver/Solver.php(740): ComposerDependencyResolverSolver->selectAndInstall()
#4 /usr/share/php/Composer/DependencyResolver/Solver.php(231): ComposerDependencyResolverSolver->runSat()
#5 /usr/share/php/Composer/Installer.php(489): ComposerDependencyResolverSolver->solve()
#6 /usr/share/php/Composer/Installer.php(232): ComposerInstaller->doInstall()
#7 /usr/share/php/Composer/Command/RequireCommand.php(248): ComposerInstaller->run()
#8 /usr/share/php/Composer/Command/RequireCommand.php(205): ComposerCommandRequireCommand->doUpdate()
#9 /usr/share/php/Symfony/Component/Console/Command/Command.php(255): ComposerCommandRequireCommand->execute()
#10 /usr/share/php/Symfony/Component/Console/Application.php(934): SymfonyComponentConsoleCommandCommand->run()
#11 /usr/share/php/Symfony/Component/Console/Application.php(273): SymfonyComponentConsoleApplication->doRunCommand()
#12 /usr/share/php/Composer/Console/Application.php(281): SymfonyComponentConsoleApplication->doRun()
#13 /usr/share/php/Symfony/Component/Console/Application.php(149): ComposerConsoleApplication->doRun()
#14 /usr/share/php/Composer/Console/Application.php(113): SymfonyComponentConsoleApplication->run()
#15 /usr/bin/composer(62): ComposerConsoleApplication->run()
#16 {main}
thrown in /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php on line 84
Fatal error: Uncaught ArgumentCountError: array_merge() does not accept unknown named parameters in /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php:84
Stack trace:
#0 [internal function]: array_merge()
#1 /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php(84): call_user_func_array()
#2 /usr/share/php/Composer/DependencyResolver/Solver.php(387): ComposerDependencyResolverDefaultPolicy->selectPreferredPackages()
#3 /usr/share/php/Composer/DependencyResolver/Solver.php(740): ComposerDependencyResolverSolver->selectAndInstall()
#4 /usr/share/php/Composer/DependencyResolver/Solver.php(231): ComposerDependencyResolverSolver->runSat()
#5 /usr/share/php/Composer/Installer.php(489): ComposerDependencyResolverSolver->solve()
#6 /usr/share/php/Composer/Installer.php(232): ComposerInstaller->doInstall()
#7 /usr/share/php/Composer/Command/RequireCommand.php(248): ComposerInstaller->run()
#8 /usr/share/php/Composer/Command/RequireCommand.php(205): ComposerCommandRequireCommand->doUpdate()
#9 /usr/share/php/Symfony/Component/Console/Command/Command.php(255): ComposerCommandRequireCommand->execute()
#10 /usr/share/php/Symfony/Component/Console/Application.php(934): SymfonyComponentConsoleCommandCommand->run()
#11 /usr/share/php/Symfony/Component/Console/Application.php(273): SymfonyComponentConsoleApplication->doRunCommand()
#12 /usr/share/php/Composer/Console/Application.php(281): SymfonyComponentConsoleApplication->doRun()
#13 /usr/share/php/Symfony/Component/Console/Application.php(149): ComposerConsoleApplication->doRun()
#14 /usr/share/php/Composer/Console/Application.php(113): SymfonyComponentConsoleApplication->run()
#15 /usr/bin/composer(62): ComposerConsoleApplication->run()
#16 {main}
thrown in /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php on line 84

这是我的composer.json

{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^8.0.2",
"guzzlehttp/guzzle": "^7.2",
"laravel/breeze": "1.9.2",
"laravel/framework": "^9.19",
"laravel/sanctum": "^3.0",
"laravel/tinker": "^2.7",
"laravel/ui": "^4.1"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.0",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
"phpunit/phpunit": "^9.5.10",
"spatie/laravel-ignition": "^1.0"
},
"autoload": {
"psr-4": {
"App": "app/",
"DatabaseFactories": "database/factories/",
"DatabaseSeeders": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"IlluminateFoundationComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r "file_exists('.env') || copy('.env.example', '.env');""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"minimum-stability": "dev",
"prefer-stable": true
}

composer和php 8.0存在一个问题,如问题单#9097所述,已在新版本pull #9076中修复

基本上,更新你的作曲器。

尝试用composer self-update更新composer,如果你仍然有相同的错误,你将需要手动更新它。

如果您不熟悉手动方法,请向了解的人求助。

  1. sudo apt install wget php-cli php-zip unzip
  2. php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
  3. HASH="$(wget -q -O - https://composer.github.io/installer.sig)"
  4. php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
Installer verified
  1. sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
All settings correct for using Composer
Downloading...
Composer (version 2.0.14) successfully installed to: 
/usr/local/bin/composer
Use it: php /usr/local/bin/composer

相关内容

  • 没有找到相关文章

最新更新