For the first time I am trying to run my Laravel project on newly Arch Linux machine and when running composer require laravel/installer
command I get this error:
Info from https://repo.packagist.org: #StandWithUkraine
Using version ^4.2 for laravel/installer
./composer.json has been updated
Running composer update laravel/installer
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
Package fzaninotto/faker is abandoned, you should avoid using it. No replacement was suggested.
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
Deprecation Notice: Return type of Illuminate\Container\Container::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Container/Container.php:1270
Deprecation Notice: Return type of Illuminate\Container\Container::offsetGet($key) should either be compatiblewith ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Container/Container.php:1281
Deprecation Notice: Return type of Illuminate\Container\Container::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Container/Container.php:1293
Deprecation Notice: Return type of Illuminate\Container\Container::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Container/Container.php:1306
> @php artisan package:discover --ansi
PHP Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Support/Collection.php:1349
Stack trace:
#0 /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Support/Collection.php(11): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()
#1 /home/brankoo/Desktop/web/vendor/composer/ClassLoader.php(571): include('...')
#2 /home/brankoo/Desktop/web/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile()
#3 /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Support/helpers.php(110): Composer\Autoload\ClassLoader->loadClass()
#4 /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php(130): collect()
#5 /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php(106): Illuminate\Foundation\PackageManifest->build()
#6 /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php(89): Illuminate\Foundation\PackageManifest->getManifest()
#7 /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php(78): Illuminate\Foundation\PackageManifest->config()
#8 /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php(26): Illuminate\Foundation\PackageManifest->aliases()
#9 /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(230): Illuminate\Foundation\Bootstrap\RegisterFacades->bootstrap()
#10 /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(310): Illuminate\Foundation\Application->bootstrapWith()
#11 /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(127): Illuminate\Foundation\Console\Kernel->bootstrap()
#12 /home/brankoo/Desktop/web/artisan(37): Illuminate\Foundation\Console\Kernel->handle()
#13 {main} in /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Support/Collection.php on line11
In Collection.php line 11:
During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection:
:offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or t
he #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/brankoo/
Desktop/web/vendor/laravel/framework/src/Illuminate/Support/Collection.php:1349
Stack trace:
#0 /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Support/Collection.php(11): Illumina
te\Foundation\Bootstrap\HandleExceptions->handleError()
#1 /home/brankoo/Desktop/web/vendor/composer/ClassLoader.php(571): include('...')
#2 /home/brankoo/Desktop/web/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile()
#3 /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Support/helpers.php(110): Composer\A
utoload\ClassLoader->loadClass()
#4 /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php(130):
collect()
#5 /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php(106):
Illuminate\Foundation\PackageManifest->build()
#6 /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php(89):
Illuminate\Foundation\PackageManifest->getManifest()
#7 /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php(78):
Illuminate\Foundation\PackageManifest->config()
#8 /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades
.php(26): Illuminate\Foundation\PackageManifest->aliases()
#9 /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(230): Ill
uminate\Foundation\Bootstrap\RegisterFacades->bootstrap()
#10 /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(310):
Illuminate\Foundation\Application->bootstrapWith()
#11 /home/brankoo/Desktop/web/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(127):
Illuminate\Foundation\Console\Kernel->bootstrap()
#12 /home/brankoo/Desktop/web/artisan(37): Illuminate\Foundation\Console\Kernel->handle()
#13 {main}
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255
This is how my composer.json file looks like:
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2.5|^8.0",
"algolia/algoliasearch-client-php": "^2.7",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^6.3",
"laravel-lang/lang": "^7.0",
"laravel/framework": "^7.24",
"laravel/scout": "^8.3",
"laravel/tinker": "^2.0",
"laravel/ui": "^2.2",
"laravelcollective/html": "^6.1",
"spatie/laravel-searchable": "^1.6"
},
"require-dev": {
"facade/ignition": "^2.0",
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.1",
"phpunit/phpunit": "^8.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\Foundation\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
}
}
Already tried recommended solutions in these two topics, none of them worked:
EDIT: Changing laravel/framework
version to ^8.75
did not solve issue as someone flagged this question as duplicate. Instead it outputted new error:
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/ui[v2.2.0, ..., v2.4.1] require php ^7.2.5 -> your php version (8.1.5) does not satisfy that requirement.
- illuminate/support[v7.0.0, ..., v7.28.4] require php ^7.2.5 -> your php version (8.1.5) does not satisfythat requirement.
- Only one of these can be installed: illuminate/support[v5.5.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev, v9.0.0-beta.1, ..., 9.x-dev], laravel/framework[v8.75.0, ..., 8.x-dev]. laravel/framework replaces illuminate/support and thus cannot coexist with it.
- laravel/ui[v2.5.0, ..., 2.x-dev] require illuminate/support ^7.0 -> satisfiable by illuminate/support[v7.0.0, ..., 7.x-dev].
- Root composer.json requires laravel/ui ^2.2 -> satisfiable by laravel/ui[v2.2.0, ..., 2.x-dev].
- Root composer.json requires laravel/framework ^8.75 -> satisfiable by laravel/framework[v8.75.0, ..., 8.x-dev].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.