skip to Main Content

i am trying to install spatie/sitemap package on my laravel package but i keep getting this error i don’t know what’s the problem :

Your requirements could not be resolved to an installable set of packages.

Problem 1

    - spatie/crawler[5.0.2, ..., v5.x-dev] require guzzlehttp/psr7 ^1.4 -> found guzzlehttp/psr7[1.4.0, ..., 1.x-dev] but the package is fixed to 2.0.0 
(lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - spatie/crawler[5.0.0, ..., 5.0.1] require php ^7.4 -> your php version (8.0.1) does not satisfy that requirement.
    - spatie/crawler 7.0.0 requires guzzlehttp/psr7 ^1.8 -> found guzzlehttp/psr7[1.8.0, 1.8.1, 1.8.2, 1.x-dev] but the package is fixed to 2.0.0 (lock 
file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - spatie/laravel-sitemap 6.0.4 requires spatie/crawler ^5.0 || ^7.0 -> satisfiable by spatie/crawler[5.0.0, 5.0.1, 5.0.2, v5.x-dev, 7.0.0].
    - Root composer.json requires spatie/laravel-sitemap 6.0.4 -> satisfiable by spatie/laravel-sitemap[6.0.4].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

i tried to specify the version of the package and used the latest one 6.0.4 but it didn’t work too and i have no idea what to do !! please some help .

UPDATE

this is composer.json :

{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
    "framework",
    "laravel"
],
"license": "MIT",
"require": {
    "php": "^8.0",
    "alexpechkarev/google-maps": "^8.0",
    "appstract/laravel-opcache": "^4.0",
    "cviebrock/eloquent-sluggable": "^8.0",
    "fideloper/proxy": "^4.4",
    "fruitcake/laravel-cors": "^2.0",
    "intervention/image": "^2.5",
    "laravel/framework": "^8.12",
    "laravel/tinker": "^2.6",
    "mews/captcha": "^3.2",
    "nesbot/carbon": "^2.48",
    "simplesoftwareio/simple-qrcode": "~4"
},
"require-dev": {
    "facade/ignition": "^2.5",
    "fakerphp/faker": "^1.9.1",
    "laravel/sail": "^1.0.1",
    "mockery/mockery": "^1.4.2",
    "nunomaduro/collision": "^5.0",
    "phpunit/phpunit": "^9.3.3"
},
"config": {
    "optimize-autoloader": true,
    "preferred-install": "dist",
    "sort-packages": true
},
"extra": {
    "laravel": {
        "dont-discover": []
    }
},
"autoload": {
    "psr-4": {
        "App\": "app/",
        "Database\Factories\": "database/factories/",
        "Database\Seeders\": "database/seeders/"
    }
},
"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"
    ]
}

}

3

Answers


  1. Chosen as BEST ANSWER

    i got it to work by installing and enabling php exif, first i installed a php exif package through composer and then i enabled it from php.ini and it worked perfectly .


  2. spatie/sitemap requires spatie/crawler, and this one (even in the latest version) requires v1 of guzzlehttp/psr7. That’s no surprise, as v2 of that package is just three weeks old, and spatie/crawler hasn’t been updated since then.

    To get to a solution, just read the error message:

    Use the option –with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

    Composer might help you to resolve the dependency problem, but only if you tell it to do so by using the -W flag.


    If this does not work: you might need to check which other package requires guzzlehttp/psr7 in v2. That is a pretty recent version, and composer why-not guzzlehttp/psr7 1.8.2 might list any package that forbids downgrading this package. If this does list any conflicting packages, you need to check further which one needs a downgrade

    Login or Signup to reply.
  3. I had a similar problem installing Google’s apiclient and I solved it by adding the following option:

    composer require google/apiclient:^2.10 --with-all-dependencies
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search