0
votes

I get this error while installing laravel sanctum by composer

Your requirements could not be resolved to an installable set of packages. Problem 1 - laravel/sanctum[v2.9.0, ..., 2.x-dev] require illuminate/contracts ^6.9|^7.0|^8.0 -> found illuminate/contracts[v6.10.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require. - Root composer.json requires laravel/sanctum ^2.9 -> satisfiable by laravel/sanctum[v2.9.0, ..., 2.x-dev].

I tried to install laravel contracts by

composer require illuminate/contracts

but get this error

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

Problem 1 - Root composer.json requires illuminate/contracts ^8.36, found illuminate/contracts[v8.36.0, v8.36.1, v8.36.2, 8.x-dev] but these were not loaded, likely because it conflicts with another require.

Composer.json

{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
    "framework",
    "laravel"
],
"license": "MIT",
"require": {
    "php": "^7.1.3",
    "darkaonline/l5-swagger": "5.8.*",
    "fideloper/proxy": "^4.0",
    "fruitcake/laravel-cors": "^2.0",
    "iatstuti/laravel-cascade-soft-deletes": "1.0.*",
    "laravel/framework": "5.8.*",
    "laravel/tinker": "^1.0",
    "laravelcollective/html": "^5.2.0",
    "morilog/jalali": "3.*",
    "niklasravnsborg/laravel-pdf": "^3.1",
    "nwidart/laravel-modules": "^5.1",
    "predis/predis": "^1.1",
    "shetabit/payment": "^2.1",
    "ext-json": "*"
},
"require-dev": {
    "beyondcode/laravel-dump-server": "^1.0",
    "filp/whoops": "^2.0",
    "fzaninotto/faker": "^1.4",
    "mockery/mockery": "^1.0",
    "nunomaduro/collision": "^3.0",
    "phpunit/phpunit": "^7.5"
},
"config": {
    "optimize-autoloader": true,
    "preferred-install": "dist",
    "sort-packages": true
},
"extra": {
    "laravel": {
    "dont-discover": []
    }
},
"autoload": {
    "psr-4": {
    "App\\": "app/",
    "Modules\\": "Modules/"
    },
    "classmap": [
    "database/seeds",
    "database/factories"
    ]
},
"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"
    ]
}
}
2
Show us your composer.json file here. Is there any other errors (problems). - Emil Georgiev
Please share more details. What does composer why-not illuminate/contracts 8.36.2 print? - Nico Haase
@NicoHaase I added the composer.json - M a m a D

2 Answers

1
votes

laravel/framework is pinned to v5.8 and laravel/sanctum is not compatible with that. It needs at least Laravel v6

-2
votes

You Need to compatible version of 'illuminate/contracts' and Apparently this package is exist in your project. check 'composer.json' file and fix 'illuminate/contracts' fits 'laravel/sanctum' and laravel version.