Composer依赖包升级从Laravel 9到10时出现冲突。

huangapple go评论90阅读模式
英文:

Composer dependencies packages conflict while trying to upgrade from Laravel 9 to 10

问题

我正在尝试将Laravel 9升级到Laravel 10,但当我尝试更新Laravel版本时,monolog/monolog包冲突,因为它在我的composer.lock文件上被锁定为2.9.1。尝试删除composer.lock,然后要求将monolog包更新到^3.0以重新生成具有新版本的composer.lock,但显然我可能做错了什么。

在我的composer.json中,如果我将laravel/framework更改为^10.0并运行composer update laravel/framework -W,我会得到以下结果:

加载包信息的Composer仓库
来自https://repo.packagist.org的信息:#StandWithUkraine
更新依赖项
您的要求无法解决为可安装的软件包集。

  问题1
    - laravel/framework[v10.0.0,...,10.x-dev]要求monolog/monolog ^3.0 ->找到monolog/monolog[dev-main,3.0.0-RC1,...,3.x-dev],但未加载这些版本,很可能是因为它与另一个要求冲突。
    - 根composer.json要求laravel/framework ^10.0 ->可满足于laravel/framework[v10.0.0,...,10.x-dev]。

这是我的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",
        "inertiajs/inertia-laravel": "^0.6.9",
        "inspector-apm/inspector-laravel": "^4.7",
        "laravel/framework": "^10.0",
        "laravel/jetstream": "^2.7",
        "laravel/sanctum": "^3.2.1",
        "laravel/tinker": "^2.7",
        "manifiesto/dashboard": "^0.4",
        "monolog/monolog": "^2.0|^3.0",
        "pestphp/pest": "^1.16",
        "pestphp/pest-plugin-laravel": "^1.1",
        "sentry/sentry-laravel": "^3.3",
        "tightenco/ziggy": "^1.0"
    },
    ...
}

所以如果我运行composer why-not spatie/laravel-ignition ^2.0,我会得到以下结果:

spatie/laravel-ignition 2.2.0 需要 illuminate/support (^10.0) 
laravel/laravel dev-develop 需要 laravel/framework (^9.2)   
找不到您要找的内容吗?尝试调用`composer update "spatie/laravel-ignition:^2.0"` --dry-run`来对问题进行另一种视角分析。

这让我感到困惑的是我无法弄清楚我首先需要升级什么或应该遵循的顺序。因为我最初以为spatie/laravel-ignition是我需要首先升级的,但当我尝试升级它时,它也会返回错误。

尝试同时更新spatie/laravel-ignitionilluminate/support只会给我这个:

composer update -W illuminate/support spatie/laravel-ignition
...
英文:

I'm trying to upgrade from Laravel 9 to Laravel 10 but when I try to update Laravel version the monolog/monolog package conflicts because it's locked to 2.9.1 on my composer.lock file. Tried deleting composer.lock, then doing a require of monolog package to ^3.0 to re-generate composer.lock again with newer version but there's something I must be doing wrong.

On my composer.json if I change laravel/framework to ^10.0 and I do composer update laravel/framework -W I get the following:

Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/framework[v10.0.0, ..., 10.x-dev] require monolog/monolog ^3.0 -> found monolog/monolog[dev-main, 3.0.0-RC1, ..., 3.x-dev] but these were not loaded, likely because it conflicts with another require.
    - Root composer.json requires laravel/framework ^10.0 -> satisfiable by laravel/framework[v10.0.0, ..., 10.x-dev].

This is my 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",
        "inertiajs/inertia-laravel": "^0.6.9",
        "inspector-apm/inspector-laravel": "^4.7",
        "laravel/framework": "^10.0",
        "laravel/jetstream": "^2.7",
        "laravel/sanctum": "^3.2.1",
        "laravel/tinker": "^2.7",
        "manifiesto/dashboard": "^0.4",
        "monolog/monolog": "^2.0|^3.0",
        "pestphp/pest": "^1.16",
        "pestphp/pest-plugin-laravel": "^1.1",
        "sentry/sentry-laravel": "^3.3",
        "tightenco/ziggy": "^1.0"
    },
    "require-dev": {
        "barryvdh/laravel-debugbar": "^3.6",
        "fakerphp/faker": "^1.9.1",
        "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,
            "php-http/discovery": true
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "repositories": [
        {
            "type": "vcs",
            "url": "git@bitbucket.org:manifiesto/dashboard.git"
        }
    ]
}

So if I do composer why-not spatie/laravel-ignition ^2.0 i get the following:

spatie/laravel-ignition 2.2.0       requires illuminate/support (^10.0) 
laravel/laravel         dev-develop requires laravel/framework (^9.2)   
Not finding what you were looking for? Try calling `composer update "spatie/laravel-ignition:^2.0" --dry-run` to get another view on the problem.

So what makes me being lost here (because I've been stuck with this for several days and I feel stuck and in a loop where everything I try to upgrade depends on another outdated package and I do not progress) is that I can't figure out what I need to upgrade first or the order I should follow. Because I tought at first that spatie/laravel-ignition was the first thing I needed to upgrade but it's also returning me errors when trying to upgrade it.

composer require "spatie/laravel-ignition:>=2.0.0" --with-all-dependencies
./composer.json has been updated
Running composer update spatie/laravel-ignition --with-all-dependencies
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 spatie/laravel-ignition >=2.0.0 -> satisfiable by spatie/laravel-ignition[2.0.0, ..., 2.2.0].
    - tightenco/ziggy is locked to version v1.6.0 and an update of this package was not requested.
    - tightenco/ziggy v1.6.0 requires laravel/framework >=5.4@dev -> satisfiable by laravel/framework[v9.2.0, ..., v9.52.10].
    - Only one of these can be installed: illuminate/support[v9.0.0, ..., v9.52.10, v10.0.0, ..., v10.14.1], laravel/framework[v9.47.0, ..., v9.52.10]. laravel/framework replaces illuminate/support and thus cannot coexist with it.
    - Conclusion: install illuminate/support v10.14.1 (conflict analysis result)


Installation failed, reverting ./composer.json and ./composer.lock to their original content.
composer require illuminate/support:10.14.1 && composer update illumiante/support
./composer.json has been updated
Running composer update illuminate/support
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 illuminate/support 10.14.1, found illuminate/support[v10.14.1] but these were not loaded, likely because it conflicts with another require.


Installation failed, reverting ./composer.json and ./composer.lock to their original content.
composer why illuminate/support
barryvdh/laravel-debugbar       v3.8.1   requires illuminate/support (^9|^10)                            
inspector-apm/inspector-laravel 4.7.31   requires illuminate/support (^5.5|^6.0|^7.0|^8.0|^9.0|^10.0)    
laravel/fortify                 v1.17.4  requires illuminate/support (^8.82|^9.0|^10.0)                  
laravel/framework               v9.52.10 replaces illuminate/support (self.version)                      
laravel/jetstream               v2.16.2  requires illuminate/support (^9.21|^10.0)                       
laravel/sail                    v1.23.0  requires illuminate/support (^8.0|^9.0|^10.0)                   
laravel/sanctum                 v3.2.5   requires illuminate/support (^9.21|^10.0)                       
laravel/tinker                  v2.8.1   requires illuminate/support (^6.0|^7.0|^8.0|^9.0|^10.0)         
sentry/sentry-laravel           3.6.0    requires illuminate/support (^6.0 | ^7.0 | ^8.0 | ^9.0 | ^10.0) 
spatie/laravel-ignition         1.6.4    requires illuminate/support (^8.77|^9.27)
composer update spatie/laravel-ignition -W
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 spatie/laravel-ignition ^2.0 -> satisfiable by spatie/laravel-ignition[2.0.0, ..., 2.2.0].
    - tightenco/ziggy is locked to version v1.6.0 and an update of this package was not requested.
    - tightenco/ziggy v1.6.0 requires laravel/framework >=5.4@dev -> satisfiable by laravel/framework[v9.2.0, ..., v9.52.10].
    - Only one of these can be installed: illuminate/support[v9.0.0, ..., v9.52.10, v10.0.0, ..., v10.14.1], laravel/framework[v9.47.0, ..., v9.52.10]. laravel/framework replaces illuminate/support and thus cannot coexist with it.
    - Conclusion: install illuminate/support v10.14.1 (conflict analysis result)

Trying to update spatie/laravel-ignition and illuminate/support at the same time just gives me this:

composer update -W illuminate/support spatie/laravel-ignition

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 illuminate/support ^10.0 -> satisfiable by illuminate/support[v10.0.0, ..., v10.14.1].
    - inertiajs/inertia-laravel v0.6.9 requires laravel/framework ^6.0|^7.0|^8.74|^9.0|^10.0 -> satisfiable by laravel/framework[v9.52.0, ..., v9.52.10].
    - Only one of these can be installed: illuminate/support[v10.0.0, ..., v10.14.1], laravel/framework[v9.52.0, ..., v9.52.10]. laravel/framework replaces illuminate/support and thus cannot coexist with it.
    - inertiajs/inertia-laravel is locked to version v0.6.9 and an update of this package was not requested.

答案1

得分: 0

看起来我部分解决了它。成功将Laravel升级到^10.0并将'spatie/laravel-ignition'升级到^2.0,似乎我只需要移除'monolog/monolog'、'spatie/laravel-ignition'和'illuminate/support'。现在我只需要确保按照预期更新我们使用的依赖包,这些包中也有一些过时的Laravel包。不管怎样,感谢你的帮助。一旦我完成了所有的升级并确保没有更多的冲突,我就会关闭这个并标记为已解决。

英文:

It seems I partially solved it. Managed to upgrade Laravel to ^10.0 and 'spatie/laravel-ignition' to ^2.0` it seems I just had to remove 'monolog/monolog', 'spatie/laravel-ignition' and 'illuminate/support'. Now I just need to make sure I update as intented the dependency package that we use that also has some Laravel packages outdated. Thanks anyway for the help. I'll close this and mark it as solved once I finish to upgrade all and make sure there's no more conflicts.

huangapple
  • 本文由 发表于 2023年6月29日 17:05:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/76579608.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定