but these conflict with your requirements or minimum-stability
Asked Answered
P

6

54

I am creating my own slackbot. I decided to use project as a library to help me.

https://github.com/sagebind/slack-client/issues?utf8=%E2%9C%93&q=stability

Now I need to install it with composer.

So I used the command: composer require coderstephen/slack-client

...And I get the error:

 Problem 1
    - Installation request for coderstephen/slack-client ^0.3.0 -> satisfiable by coderstephen/slack-client[v0.3.0].
    - coderstephen/slack-client v0.3.0 requires devristo/phpws dev-master -> satisfiable by devristo/phpws[dev-master] but these conflict with your requirements or minimum-stability.

Ok - So then I decided to change my stability level to "dev" in my composer.lock:

"aliases": [],
    "minimum-stability": "dev",
    "stability-flags": {
        "devristo/phpws": 20
    },
    "prefer-stable": true,
    "prefer-lowest": false,
    "platform": {
        "php": ">=5.5"
    },
    "platform-dev": []

Now I'm running out of ideas on what to do. The README says to do this step in composer.json but, no such settings exist:

Please note that the current version has unstable dependencies.

In order to install those dependencies, you can set "minimum-stability" in your composer.json, and recommend that you set "prefer-stable":

My composer.json:

{
    "name": "coderstephen/slack-client",
    "keywords": ["slack", "api", "realtime"],
    "license": "MIT",
    "description": "A better Slack client, with RTM API support",
    "authors": [{
        "name": "Stephen Coakley",
        "email": "[email protected]"
    }],
    "require": {
        "php": ">=5.5",
        "devristo/phpws": "dev-master",
        "evenement/evenement": "2.0.*",
        "guzzlehttp/guzzle": "~6.0",
        "react/event-loop": "^0.4.1",
        "react/promise": "^2.2"
    },
    "require-dev": {
        "phpunit/phpunit": "~4.6",
        "fzaninotto/faker": "~1.4",
        "apigen/apigen": "^4.1"
    },
    "autoload": {
        "psr-4": {
            "Slack\\": "src"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Slack\\Tests\\": "tests"
        }
    }
}

Does anyone know some solutions I could try?

Pazit answered 10/7, 2017 at 19:2 Comment(0)
A
83

Add minimum-stability and prefer-stable to your composer.json (not composer.lock):

{
    "name": "coderstephen/slack-client",
    "keywords": ["slack", "api", "realtime"],
    "license": "MIT",
    "description": "A better Slack client, with RTM API support",
    "authors": [{
        "name": "Stephen Coakley",
        "email": "[email protected]"
    }],
    "require": {
        "php": ">=5.5",
        "devristo/phpws": "dev-master",
        "evenement/evenement": "2.0.*",
        "guzzlehttp/guzzle": "~6.0",
        "react/event-loop": "^0.4.1",
        "react/promise": "^2.2"
    },
    "require-dev": {
        "phpunit/phpunit": "~4.6",
        "fzaninotto/faker": "~1.4",
        "apigen/apigen": "^4.1"
    },
    "autoload": {
        "psr-4": {
            "Slack\\": "src"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Slack\\Tests\\": "tests"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}
Are answered 10/7, 2017 at 19:5 Comment(0)
L
55

For others having the same issue, these changes are best done using composer itself instead of manually modifying the composer.json file. Just run the following commands in the console:

$ composer config minimum-stability dev

$ composer config prefer-stable true

Now you can require and update the package:

$ composer require --no-update "vendor/package-name:version"

$ composer update

Available options (in order of stability) are dev, alpha, beta, RC, and stable

London answered 22/5, 2019 at 18:4 Comment(1)
This is the perfect way to enable the Dev packages on composer. Thanks @DanielBurt
D
10

You should never manually edit the composer.lock file - it is an automatically generated file.

It looks like you've shown the composer.json file of the package you're trying to require rather than your own project's composer.json. The prefer-stable and minimum-stability properties should be added to your project root's composer.json file:

{
  "name": "xFlare/slack-bot",
  "description": "xFlare's Slack bot project",
  "authors": [
    {
      "name": "xFlare"
    }
  ],
  "minimum-stability": "dev",
  "prefer-stable": true,
  "require": {
    "php": ">=5.5",
    "coderstephen/slack-client": "^0.3.0"
  }
}
Decoupage answered 10/7, 2017 at 19:5 Comment(2)
Problem 1 - Installation request for coderstephen/slack-client ^0.3.0 -> satisfiable by coderstephen/slack-client[v0.3.0]. - coderstephen/slack-client v0.3.0 requires devristo/phpws dev-master -> satisfiable by devristo/phpws[dev-master] but these conflict with your requirements or minimum-stability. - Still get this errorPazit
You need to add this to the project root's composer.json file, not the coderstephen/slack-client package's composer.jsonDecoupage
L
8

Usually, this issue has nothing to do directly with minimum-stability or prefer-stable option, but the case is just that you already use some library directly or indirectly, that is needed in another library you use but in a higher version.

My case: Got this error message for a Codeception library which needed a dependency of PHPUnit at least of version 6 and above (>= 6) , but it clashed with the lower version 4 of PHPUnit dependency, which I had installed/required directly already before prior it (as a package in my composer.json file). (my specific case could not use higher PHPUnit than version 6, since it was the last version which supported php version I used).

You might ask if it might affect your project, which already relies on the lower version of the library, perhaps there could be some breaking change, but I don't know if there could be some workaround for using one version for dependency and another version for own project.

Edit: I also had to issue a remove composer command for phpunit dependency, otherwise I was not able to increase my phpunit version directly.

Lyrate answered 19/10, 2019 at 18:46 Comment(0)
W
1

You should add the minimum-stability in your composer.json not in the composer.lock. The option exists see https://getcomposer.org/doc/04-schema.md#minimum-stability

Whippletree answered 10/7, 2017 at 19:8 Comment(0)
S
0

i had the error in a symfony4 project with own bundles.

my-foo-bundle dev-master requires ramsey/uuid-doctrine ^1.5 -> satisfiable by ramsey/uuid-doctrine[1.5.0, 1.6.0] but these conflict with your requirements or minimum-stability.

the solution, i search for "ramsey/uuid-doctrine" in my bundles and i found different requirements "ramsey/uuid-doctrine ^1.5" (in my-foo-bundle) and "ramsey/uuid-doctrine dev-master" (in my app-configuration). So i delete the requirement in the app/composer.json.

This worked for me.

Suzan answered 22/9, 2020 at 4:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.