Home > Back-end >  Issue installing laravel-doctrine/migrations package in laravel 9
Issue installing laravel-doctrine/migrations package in laravel 9

Time:11-23

I am trying to install the migrations on a fresh install of laravel 9, however I am getting this error

Problem 1

  • Root composer.json requires laravel-doctrine/migrations ^2.3 -> satisfiable by laravel-doctrine/migrations[2.3.0, 2.3.1, 2.x-dev].
  • laravel-doctrine/migrations[2.3.0, ..., 2.x-dev] require illuminate/config ^6.0|^7.0|^8.0 -> found illuminate/config[v6.0.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.

You can also try re-running composer require with an explicit version constraint, e.g. "composer require laravel-doctrine/migrations:*" to figure out if any version is installable, or "composer require laravel-doctrine/migrations:^2.1" if you know which you need.

previously I installed the orm with this command

composer require laravel-doctrine/orm

I have tried to install other versions but the message is the same

composer.json

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "php": "^8.0.2",
        "guzzlehttp/guzzle": "^7.2",
        "laravel-doctrine/orm": "^1.8",
        "laravel-doctrine/migrations":"^2.3",
        "laravel/framework": "^9.19",
        "laravel/sanctum": "^3.0",
        "laravel/tinker": "^2.7"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9.1",
        "laravel/pint": "^1.0",
        "laravel/sail": "^1.0.1",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^6.1",
        "phpunit/phpunit": "^9.5.10",
        "spatie/laravel-ignition": "^1.0"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "allow-plugins": {
            "pestphp/pest-plugin": true
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

UPDATE

I am trying to install the package with laravel 8 however I have this error when executing the command for version ~1.7

command

composer require laravel-doctrine/orm doctrine/inflector:"^1.4|^2.0"

Error

Problem 1 - laravel-doctrine/orm[1.8.0, ..., 1.8.x-dev] require illuminate/support ^9.0 -> found illuminate/support[v9.0.0-beta.1, ..., 9.x-dev] but these were not loaded, likely because it conflicts with another require. - Root composer.json requires laravel-doctrine/orm ^1.8 -> satisfiable by laravel-doctrine/orm[1.8.0, 1.8.1, 1.8.x-dev].

You can also try re-running composer require with an explicit version constraint, e.g. "composer require laravel-doctrine/orm:*" to figure out if any version is installable, or "composer require laravel-doctrine/orm:^2.1" if you know which you need.

CodePudding user response:

doctrine-migrations does not support laravel 9 at yet. See this discussion

It will be supported after it upgrade to doctrine/migrations 3 in this Pull Request

So if you want to really install doctrine/migrations, you need to use Laravel 8 instead of laravel 9.

Otherwise, you need to wait untill that PR merged and released

CodePudding user response:

SOLVED

Currently doctrine/migrations can be installed using this command

composer require laravel-doctrine/orm "^1.7" doctrine/inflector:"^1.4|^2.0"

after install the packages you can install migations with no problems

Note that version 1.7 must be specified in the command, since it does not appear explicitly in the documentation

  • Related