Tuesday, January 4, 2022

[FIXED] error installing a package " Installation failed, reverting ./composer.json and ./composer.lock to their original content. "

Issue

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"
    ]
}

}


Solution

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 .



Answered By - mnm.mtl

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.