raviawasti's avatar

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

Hi Everyone,

I am currently running my laravel project in localhost-Xampp (Ubuntu 20).

My system php version is 8.1.4

Everything was working fine as usual but when i try to install this package https://github.com/jenssegers/agent by typing the command in my terminal "composer require jenssegers/agent" i am getting multiple issue.

Here is the terminal issues

Info from https://repo.packagist.org: #StandWithUkraine
Using version ^2.6 for jenssegers/agent
./composer.json has been updated
Running composer update jenssegers/agent
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 php ^7.3 but your php version (8.1.4) does not satisfy that requirement.
  Problem 2
    - cartalyst/stripe-laravel is locked to version v12.0.0 and an update of this package was not requested.
    - cartalyst/stripe-laravel v12.0.0 requires php ^7.2.5 -> your php version (8.1.4) does not satisfy that requirement.
  Problem 3
    - spatie/laravel-sitemap is locked to version 5.8.0 and an update of this package was not requested.
    - spatie/laravel-sitemap 5.8.0 requires php ^7.2 -> your php version (8.1.4) does not satisfy that requirement.
  Problem 4
    - zanysoft/laravel-zip is locked to version 1.0.5 and an update of this package was not requested.
    - zanysoft/laravel-zip 1.0.5 requires ext-zip * -> it is missing from your system. Install or enable PHP's zip extension.
  Problem 5
    - fzaninotto/faker is locked to version v1.9.2 and an update of this package was not requested.
    - fzaninotto/faker v1.9.2 requires php ^5.3.3 || ^7.0 -> your php version (8.1.4) does not satisfy that requirement.
  Problem 6
    - phpunit/phpunit is locked to version 8.5.33 and an update of this package was not requested.
    - phpunit/phpunit 8.5.33 requires ext-dom * -> it is missing from your system. Install or enable PHP's dom extension.
  Problem 7
    - tijsverkoyen/css-to-inline-styles 2.2.6 requires ext-dom * -> it is missing from your system. Install or enable PHP's dom extension.
    - laravel/framework v7.30.6 requires tijsverkoyen/css-to-inline-styles ^2.2.2 -> satisfiable by tijsverkoyen/css-to-inline-styles[2.2.6].
    - laravel/framework is locked to version v7.30.6 and an update of this package was not requested.

To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/8.1/cli/php.ini
    - /etc/php/8.1/cli/conf.d/10-opcache.ini
    - /etc/php/8.1/cli/conf.d/10-pdo.ini
    - /etc/php/8.1/cli/conf.d/20-calendar.ini
    - /etc/php/8.1/cli/conf.d/20-ctype.ini
    - /etc/php/8.1/cli/conf.d/20-curl.ini
    - /etc/php/8.1/cli/conf.d/20-exif.ini
    - /etc/php/8.1/cli/conf.d/20-ffi.ini
    - /etc/php/8.1/cli/conf.d/20-fileinfo.ini
    - /etc/php/8.1/cli/conf.d/20-ftp.ini
    - /etc/php/8.1/cli/conf.d/20-gettext.ini
    - /etc/php/8.1/cli/conf.d/20-iconv.ini
    - /etc/php/8.1/cli/conf.d/20-phar.ini
    - /etc/php/8.1/cli/conf.d/20-posix.ini
    - /etc/php/8.1/cli/conf.d/20-readline.ini
    - /etc/php/8.1/cli/conf.d/20-shmop.ini
    - /etc/php/8.1/cli/conf.d/20-sockets.ini
    - /etc/php/8.1/cli/conf.d/20-sysvmsg.ini
    - /etc/php/8.1/cli/conf.d/20-sysvsem.ini
    - /etc/php/8.1/cli/conf.d/20-sysvshm.ini
    - /etc/php/8.1/cli/conf.d/20-tokenizer.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-zip --ignore-platform-req=ext-dom --ignore-platform-req=ext-dom` to temporarily ignore these required extensions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require jenssegers/agent:*" to figure out if any version is installable, or "composer require jenssegers/agent:^2.1" if you know which you need.

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

Here is my composer.json file

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.3|^8.0",
        "anhskohbo/no-captcha": "^3.3",
        "authorizenet/authorizenet": "^2.0",
        "cartalyst/stripe-laravel": "^12.0",
        "doctrine/dbal": "^2.12.1",
        "fideloper/proxy": "^4.2",
        "fruitcake/laravel-cors": "^1.0",
        "guzzlehttp/guzzle": "^6.3",
        "intervention/image": "^2.6",
        "laravel/framework": "^7.0",
        "laravel/socialite": "^5.2",
        "laravel/tinker": "^2.0",
        "mercadopago/dx-php": "2.2.1",
        "mollie/laravel-mollie": "^2.0",
        "paypal/rest-api-sdk-php": "^1.14",
        "phpmailer/phpmailer": "^6.1",
        "rachidlaasri/laravel-installer": "^4.1",
        "razorpay/razorpay": "^2.5",
        "spatie/laravel-cookie-consent": "^2.12",
        "spatie/laravel-sitemap": "^5.8.0",
        "twilio/sdk": "^6.28",
        "zanysoft/laravel-zip": "^1.0"
    },
    "require-dev": {
        "facade/ignition": "^2.0",
        "fzaninotto/faker": "^1.9.1",
        "mockery/mockery": "^1.3.1",
        "nunomaduro/collision": "^4.1",
        "phpunit/phpunit": "^8.5"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "psr-4": {
            "App\": "app/"
        },
        "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"
        ]
    }
}

Please guide me how to resolve it. please

0 likes
6 replies
NoLAstNamE's avatar

You are using an older version of Laravel (7.x) which doesn't support PHP 8.1

Try to update your composer.json but I'm not sure of this

"require": {
    "php": "^7.3|^8.1",
mrbegginerak's avatar

Maybe You can try "jenssegers/agent": "^3.0" in your composer json under require

krisi_gjika's avatar

that package seems abandoned and not updated to current php versions.

raviawasti's avatar

I am getting this error whenever i tried to install any new package, why i am getting this error ?

Please or to participate in this conversation.