I have a blank Laravel 9 install. The only extensions added are jetstream and livewire. I am trying to install spatie/laravel-comments package, but I get the following error.
Your requirements could not be resolved to an installable set of
packages.Problem 1
– Root composer.json requires spatie/laravel-comments ^0.0.2 -> satisfiable by spatie/laravel-comments[0.0.2].
– spatie/laravel-comments 0.0.2 requires illuminate/contracts ^8.73 -> found illuminate/contracts[v8.73.0, …, 8.x-dev] but these
were not loaded, likely because it conflicts with another require.You can also try re-running composer require with an explicit version
constraint, e.g. "composer require spatie/laravel-comments:*" to
figure out if any version is installable, or "composer require
spatie/laravel-comments:^2.1" if you know which you need.Installation failed, reverting ./composer.json and ./composer.lock to
their original content.
The same error occurs if I specify a version to install or leave it open for latest. I have tried removing the composer.lock file and reinstalling everything, my composer.json looks like.
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^8.0.2",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^9.11",
"laravel/jetstream": "^2.8",
"laravel/sanctum": "^2.14.1",
"laravel/tinker": "^2.7",
"livewire/livewire": "^2.10"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"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/",
"Database\Factories\": "database/factories/",
"Database\Seeders\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\Foundation\ComposerScripts::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
},
"minimum-stability": "dev",
"prefer-stable": true
}
Versions I’m using are:
composer -v = 2.4
php -v 8.1.3
and I’m on Windows
2
Answers
As you can see on the package’s packagist overview, the package is not compatible with Laravel 9. But that is not the largest problem of that package: it is no longer available on Github, so downloading the code might fail.
You should use any other package that suits your needs, or contact the maintainers. Maybe Spatie will re-publish it, and make it compatible with Laravel 9?
I’ve faced this issue once, and i think you need to run this command only
Hope this will fix.
and for Spatie installation you can find everything here SPATIE Installation