Search code examples
phplaravelcomposer-phplaravel-datatables

Unable to understand why I cannot install laravel-datatables


I'm mantaining an old project, started with laravel 5.4, and now lifted up to laravel 8.

It's all working.

Now I'm in need to install laravel-datatables.

Looking at doc, I discarded v10 because it requires Laravel 9+ For same reason, I discarded also v9 So I'm trying to install laravel-datatables v8

composer require yajra/laravel-datatables-oracle:^8.0

I got this

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

  Problem 1
    - Root composer.json requires yajra/laravel-datatables-oracle 8.0 -> satisfiable by yajra/laravel-datatables-oracle[v8.0.0].
    - yajra/laravel-datatables-oracle v8.0.0 requires illuminate/database 5.4.*|5.5.* -> found illuminate/database[v5.4.0, ..., 5.5.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.

I am not able to understand which package/require is conflicting with this package.

This my package.json

"require": {
    "php": "^7.3|^8.0",
    "ext-json": "*",
    "barryvdh/laravel-dompdf": "^0.8.1",
    "buzz/laravel-google-captcha": "^2.1",
    "carlos-meneses/laravel-mpdf": "^2.1",
    "davidepastore/codice-fiscale": "^0.7.1",
    "doctrine/dbal": "^3.0",
    "fideloper/proxy": "^4.4",
    "fruitcake/laravel-cors": "^2.0",
    "guzzlehttp/guzzle": "^7.3",
    "laravel/framework": "^8.12",
    "laravel/tinker": "^2.5",
    "laravel/ui": "^3.2",
    "league/flysystem-sftp": "~1.0",
    "maatwebsite/excel": "^3.1",
    "nowakowskir/php-jwt": "^2.0",
    "oriceon/toastr-5-laravel": "^1.0.0",
    "pragmarx/google2fa-laravel": "^1.4",
    "pragmarx/recovery": "^0.2.0",
    "ramsey/uuid": "^4.1",
    "sentry/sdk": "^3.1",
    "sentry/sentry-laravel": "^2.4",
    "shalvah/laravel-jsend": "^2.3",
    "snowfire/beautymail": "^1.1"
},
"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"
},

Same problem with v7

Please note: we cannot, for internal policy, use -dev branches

Trying to install v9 ...

  Problem 1
    - Root composer.json requires yajra/laravel-datatables-oracle 9 -> satisfiable by yajra/laravel-datatables-oracle[v9.0.0].
    - yajra/laravel-datatables-oracle v9.0.0 requires illuminate/database 5.8.* -> found illuminate/database[v5.8.0, ..., 5.8.x-dev] but these were not loaded, likely because it conflicts with another require.

Solution

  • As written in the error message: yajra/laravel-datatables-oracle in v8 is only compatible with Laravel v5, and you are using Laravel v8.

    Try to use composer require yajra/laravel-datatables-oracle:^9.0 - this version is compatible with Laravel v5 to v8. Next time you are facing such a problem, have a look at the constraints of different versions of the package. Packagist has a pretty nice overview of the compatible versions, for example at https://packagist.org/packages/yajra/laravel-datatables-oracle#v9.21.2 where you can see the dependencies for the latest v9 version of that datatables package