Search code examples
laravelcomposer-php

Why running composer I got error that it does not match the constraint


I need to run laravel app with defined in composer file:

"require": {
    "php": "^8.1",
    "laravel/framework": "^10.0",
    "tatumio/tatum-php": "^2.0",

on my php8.3 with apache 2

But composer raises an error:

Problem 1
- Root composer.json requires tatumio/tatum-php ^2.0, found tatumio/tatum-php[dev-master] but it does not match the constraint.

But why I get this error?

The repository https://github.com/tatumio/tatum-php is archived now and in composer file I see

"minimum-stability": "stable",
"prefer-stable": true

but dev-master in error message...

How can I run the app?

Additional details:

In composer.json file I added a block:

"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/markjivko/tatum-php"
    }
],

Not sure if type="vcs" is valid here. I have also modified the require block:

"require": {
    "php": "^8.1",
    "laravel/framework": "^10.0",
    "markjivko/tatum-php": "master",
},

I suppose that for markjivko/tatum-php package the valid value is master, but why then error and which is the valid syntax?


Solution

  • You get the error because, as the error message says, there is no package published under version 2.0.

    If you check on Packagist, you'll see that the only version installed is the master branch.

    You do not even need to create an additional repositories configuration, you can remove that part from your composer.json.

    You simply need to specify the version constraint correctly:

    In your case it would be:

    "require": {
        "php": "^8.1",
        "laravel/framework": "^10.0",
        "tatumio/tatum-php": "dev-master"
    }