Issue installing composer package for Laravel, Voyager 1.4

2.8k Views Asked by At

I am still sort of a newbie with Laravel, and I want to install the Voyager admin panel in an existing Laravel app that is not too far along yet in development. The GitHub for Voyager is here:

Voyager Laravel Admin

The CLI is:

sscotti@iMac-Catalina PortalRads % composer require tcg/voyager
Using version ^1.4 for tcg/voyager
./composer.json has been updated
Running composer update tcg/voyager
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - tcg/voyager[1.4.x-dev, ..., 1.x-dev] require doctrine/dbal ^2.5 -> found doctrine/dbal[v2.5.0-BETA2, ..., 2.13.x-dev] but the package is fixed to 3.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - tcg/voyager[v1.4.0, ..., v1.4.2] require illuminate/support ~6.0|~7.0 -> found illuminate/support[v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev] but these were not loaded, likely because it conflicts with another require.
    - Root composer.json requires tcg/voyager ^1.4 -> satisfiable by tcg/voyager[v1.4.0, ..., 1.x-dev].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

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

Before I mess around with it too much, wanted to see what the proper way is to upgrade or adjust my packages to work with that.

The composer.json is kind of big, but the most important part is probably:

"require": {
    "php": "^7.3|^8.0",
    "aranyasen/hl7": "^2.0",
    "aws/aws-sdk-php": "^3.163",
    "barryvdh/laravel-snappy": "^0.4.8",
    "bower-asset/bootstrap": "~4.5",
    "bower-asset/dropzone": "^5.7",
    "bower-asset/font-awesome": "~5.14",
    "bower-asset/jquery": "^3.5.1",
    "bower-asset/jquery-migrate": "~3.0",
    "bower-asset/jquery-timepicker-jt": "~1.13",
    "bower-asset/jquery-ui": "~1.12",
    "bower-asset/jquery-validation": "~1.19",
    "bower-asset/moment": "^2.29",
    "bower-asset/moment-timezone": "^0.5.31",
    "bower-asset/pdfjs-dist": "~2.6.347",
    "bower-asset/plupload": "~3.1.2",
    "bower-asset/sumoselect": "~3.0",
    "fideloper/proxy": "^4.2",
    "fruitcake/laravel-cors": "^2.0",
    "fzaninotto/faker": "^1.5",
    "google/recaptcha": "^1.2",
    "guzzlehttp/guzzle": "^7.0.1",
    "intervention/image": "^2.5",
    "jenssegers/agent": "^2.6",
    "laracademy/generators": "^3.0",
    "laravel/framework": "^8.0",
    "laravel/jetstream": "^2.2",
    "laravel/sanctum": "^2.6",
    "laravel/tinker": "^2.0",
    "league/oauth2-google": "^3.0",
    "livewire/livewire": "^2.4",
    "nesbot/carbon": "^2.42",
    "oomphinc/composer-installers-extender": "2.0",
    "phpmailer/phpmailer": "^6.1",
    "rbdwllr/reallysimplejwt": "^4.0",
    "spatie/laravel-cookie-consent": "^2.12",
    "spatie/laravel-csp": "^2.6",
    "spatie/laravel-permission": "^4.0",
    "yajra/laravel-datatables-oracle": "^9.15"

I did not try the --with-all-dependencies option, and I am not sure if there is a 'dry-run' option for composer.

There are special instructions for installing over an existing Laravel app, but I need to get the package to install first. See: Install for Existing App

2

There are 2 best solutions below

1
On BEST ANSWER
  Problem 1
    - tcg/voyager[1.4.x-dev, ..., 1.x-dev] require doctrine/dbal ^2.5 -> found doctrine/dbal[v2.5.0-BETA2, ..., 2.13.x-dev] but the package is fixed to 3.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - tcg/voyager[v1.4.0, ..., v1.4.2] require illuminate/support ~6.0|~7.0 -> found illuminate/support[v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev] but these were not loaded, likely because it conflicts with another require.
    - Root composer.json requires tcg/voyager ^1.4 -> satisfiable by tcg/voyager[v1.4.0, ..., 1.x-dev].

The important parts are given in line 2: you are using Laravel v8, but tcg/voyager is not compatible with that. There are multiple bug tickets in their repository about this, but until this is fixed, you either have to downgrade Laravel or resign from using Voyager

0
On

This happened to me. I fixed it by downgrading the doctrine/dbal to ^2.6 version because none of other packages on my project need DBAL version later than 2.6

https://github.com/the-control-group/voyager/issues/5391#issuecomment-873819579