PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, February 5, 2022

[FIXED] Composer version matching error laravel + spatie medialibrary

 February 05, 2022     composer-php, laravel, laravel-medialibrary, php     No comments   

Issue

I try to create a new laravel app via the laravel installer with laravel new <appname>.

This works without a problem. Once I try to install the spatie/medialibrary I get the following error that I cannot explain:

$ composer require "spatie/laravel-medialibrary:^9.0.0"
./composer.json has been updated
Running composer update spatie/laravel-medialibrary
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - spatie/laravel-medialibrary[9.0.0, ..., 9.6.4] require spatie/image ^1.4.0 -> satisfiable by spatie/image[1.4.0, ..., v1.x-dev].
    - spatie/image[1.10.0, ..., v1.x-dev] require league/glide ^1.6 -> satisfiable by league/glide[1.6.0, 1.6.1, 1.7.0, 1.x-dev].
    - spatie/image[1.7.5, ..., 1.9.0] require league/glide ^1.4 -> satisfiable by league/glide[1.4.0, ..., 1.x-dev].
    - league/glide[1.4.0, ..., 1.x-dev] require intervention/image ^2.4 -> satisfiable by intervention/image[2.4.0, ..., 2.5.1].
    - intervention/image 2.4.x-dev is an alias of intervention/image dev-master and thus requires it to be installed too.
    - spatie/image 1.10.3 requires league/glide ^2.0 -> satisfiable by league/glide[2.0.0, 2.0.x-dev].
    - intervention/image[dev-master, 2.4.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.
    - league/glide 2.0.x-dev requires 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.
    - league/glide 2.0.0 requires league/flysystem ^2.0 -> found league/flysystem[2.0.0-alpha.1, ..., 2.x-dev] but the package is fixed to 1.1.4 (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/image 1.4.0 requires symfony/process ^3.0 -> found symfony/process[v3.0.0-BETA1, ..., 3.4.x-dev] but the package is fixed to v5.3.2 (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/image[1.4.1, ..., 1.7.4] require symfony/process ^3.0|^4.0 -> found symfony/process[v3.0.0-BETA1, ..., 3.4.x-dev, v4.0.0-BETA1, ..., 4.4.x-dev] but the package is fixed to v5.3.2 (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 spatie/laravel-medialibrary ^9.0.0 -> satisfiable by spatie/laravel-medialibrary[9.0.0, ..., 9.6.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.

Even if I try to allow composer to automatically up/downgrade the missmatching packages I still get a similar error:

$ composer require "spatie/laravel-medialibrary:^9.0.0" -W                                                                                                                             
./composer.json has been updated
Running composer update spatie/laravel-medialibrary --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires laravel/framework ^8.0, found laravel/framework[v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.


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

Here is also my composer.json for good measure:

{
    "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.0.1",
        "laravel/framework": "^8.0",
        "laravel/tinker": "^2.5"
    },
    "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
}

Composer version: Composer version 2.1.3 2021-06-09 16:31:20

PHP version:

$ php -v
PHP 7.4.9 (cli)

I do not understand what the problem here is, the requirements for the laravel installation are fullfilled by the fresh creation of the app an the medialibrary package requires the laravel framework in version 7+.

Am I missing something the tells me whats wrong?

Thanks


Solution

You can ignore platform requirements by running

 composer install --ignore-platform-reqs

or upgrades, downgrades with this

composer install --with-all-dependencies

and also delete the composer.lock file (before installing)

sudo rm  composer.lock


Answered By - Syed Umair
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

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

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing