2

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

Problem 1

- intervention/image[2.5.0, ..., 2.5.1] require guzzlehttp/psr7 ~1.1 -> found guzzlehttp/psr7[1.1.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.
- Root composer.json requires intervention/image ^2.5 -> satisfiable by intervention/image[2.5.0, 2.5.1].

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

composer.json

{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
    "php": "^7.3|^8.0",
    "fideloper/proxy": "^4.4",
    "fruitcake/laravel-cors": "^2.0",
    "guzzlehttp/guzzle": "^7.3",
    "laravel/framework": "^8.40",
    "laravel/tinker": "^2.5",
    "laravel/ui": "^3.3"
},
"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"
},
"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-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
}  
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Nazmul Hoque
  • 761
  • 9
  • 9

5 Answers5

5

Solution

  1. Go to composer.lock file and search guzzlehttp/psr7 , you will find something like this
    "name": "guzzlehttp/psr7",
    "version": "2.0.0",
  1. Change the "version" to "1.7.0"

  2. Run the command again composer require intervention/image. If you see a message stating that "downgrading psr7 (2.0.0 => 1.7.0)" (I'm using powershell btw), that means everything runs correctly.

Attempt Explanation

The error message stated that in order to install intervention/image, it needs guzzlehttp/psr7[1.1.0, ..., 1.x-dev]. Which means it needs psr7 with version 1.x , however, the psr7 that was in laravel 8 is version 2.0.0 and that's incompatible. Learn more about semantic versioning here

You can check this in your composer.lock file, by searching "guzzlehttp/psr7" then you will see something like this

    "name": "guzzlehttp/psr7",
    "version": "2.0.0",

Hence, you need to downgrade it to 1.x version. But there are many 1.x version as well, the one I choose is 1.7.0 because in guzzlehttp root package, there are some other sub package (my terminology used might be inappropriate, pardon me) that requires psr7 to be at least 1.7.0, that's why I chose 1.7.0 , and so far, the intervention/image packages works fine for me.

I saw some others comment about deleting composer.lock file, and it works. However I have some concern about deleting composer.lock file as it contains very important info in it...

2

Delete composer.lock in the vendor folder then run composer require intervention/image

1

Do the following to downgrade psr7 to version 1.7.0:

composer require guzzlehttp/psr7:1.7.0
Petar Vasilev
  • 4,281
  • 5
  • 40
  • 74
0

Finally I solved the problem

I just delete vendor and composer.lok file and run

Composer require intervention/image --ignore-platform-reqs

It's solve the problem

Nazmul Hoque
  • 761
  • 9
  • 9
0

composer require guzzlehttp/psr7 "^1.5" Then composer require beyondcode/laravel-websockets

Peter Csala
  • 17,736
  • 16
  • 35
  • 75
Ali
  • 1
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 18 '21 at 06:36