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

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

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,我会得到以下结果:

  1. 加载包信息的Composer仓库
  2. 来自https://repo.packagist.org的信息:#StandWithUkraine
  3. 更新依赖项
  4. 您的要求无法解决为可安装的软件包集。
  5. 问题1
  6. - laravel/framework[v10.0.0,...,10.x-dev]要求monolog/monolog ^3.0 ->找到monolog/monolog[dev-main3.0.0-RC1,...,3.x-dev],但未加载这些版本,很可能是因为它与另一个要求冲突。
  7. - composer.json要求laravel/framework ^10.0 ->可满足于laravel/framework[v10.0.0,...,10.x-dev]。

这是我的composer.json

  1. {
  2. "name": "laravel/laravel",
  3. "type": "project",
  4. "description": "The Laravel Framework.",
  5. "keywords": ["framework", "laravel"],
  6. "license": "MIT",
  7. "require": {
  8. "php": "^8.0.2",
  9. "guzzlehttp/guzzle": "^7.2",
  10. "inertiajs/inertia-laravel": "^0.6.9",
  11. "inspector-apm/inspector-laravel": "^4.7",
  12. "laravel/framework": "^10.0",
  13. "laravel/jetstream": "^2.7",
  14. "laravel/sanctum": "^3.2.1",
  15. "laravel/tinker": "^2.7",
  16. "manifiesto/dashboard": "^0.4",
  17. "monolog/monolog": "^2.0|^3.0",
  18. "pestphp/pest": "^1.16",
  19. "pestphp/pest-plugin-laravel": "^1.1",
  20. "sentry/sentry-laravel": "^3.3",
  21. "tightenco/ziggy": "^1.0"
  22. },
  23. ...
  24. }

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

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

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

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

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

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:

  1. Loading composer repositories with package information
  2. Info from https://repo.packagist.org: #StandWithUkraine
  3. Updating dependencies
  4. Your requirements could not be resolved to an installable set of packages.
  5. Problem 1
  6. - 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.
  7. - Root composer.json requires laravel/framework ^10.0 -> satisfiable by laravel/framework[v10.0.0, ..., 10.x-dev].

This is my composer.json

  1. {
  2. "name": "laravel/laravel",
  3. "type": "project",
  4. "description": "The Laravel Framework.",
  5. "keywords": ["framework", "laravel"],
  6. "license": "MIT",
  7. "require": {
  8. "php": "^8.0.2",
  9. "guzzlehttp/guzzle": "^7.2",
  10. "inertiajs/inertia-laravel": "^0.6.9",
  11. "inspector-apm/inspector-laravel": "^4.7",
  12. "laravel/framework": "^10.0",
  13. "laravel/jetstream": "^2.7",
  14. "laravel/sanctum": "^3.2.1",
  15. "laravel/tinker": "^2.7",
  16. "manifiesto/dashboard": "^0.4",
  17. "monolog/monolog": "^2.0|^3.0",
  18. "pestphp/pest": "^1.16",
  19. "pestphp/pest-plugin-laravel": "^1.1",
  20. "sentry/sentry-laravel": "^3.3",
  21. "tightenco/ziggy": "^1.0"
  22. },
  23. "require-dev": {
  24. "barryvdh/laravel-debugbar": "^3.6",
  25. "fakerphp/faker": "^1.9.1",
  26. "laravel/sail": "^1.0.1",
  27. "mockery/mockery": "^1.4.4",
  28. "nunomaduro/collision": "^6.1",
  29. "phpunit/phpunit": "^9.5.10",
  30. "spatie/laravel-ignition": "^1.0"
  31. },
  32. "autoload": {
  33. "psr-4": {
  34. "App\\": "app/",
  35. "Database\\Factories\\": "database/factories/",
  36. "Database\\Seeders\\": "database/seeders/"
  37. }
  38. },
  39. "autoload-dev": {
  40. "psr-4": {
  41. "Tests\\": "tests/"
  42. }
  43. },
  44. "scripts": {
  45. "post-autoload-dump": [
  46. "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
  47. "@php artisan package:discover --ansi"
  48. ],
  49. "post-update-cmd": [
  50. "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
  51. ],
  52. "post-root-package-install": [
  53. "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
  54. ],
  55. "post-create-project-cmd": [
  56. "@php artisan key:generate --ansi"
  57. ]
  58. },
  59. "extra": {
  60. "laravel": {
  61. "dont-discover": []
  62. }
  63. },
  64. "config": {
  65. "optimize-autoloader": true,
  66. "preferred-install": "dist",
  67. "sort-packages": true,
  68. "allow-plugins": {
  69. "pestphp/pest-plugin": true,
  70. "php-http/discovery": true
  71. }
  72. },
  73. "minimum-stability": "dev",
  74. "prefer-stable": true,
  75. "repositories": [
  76. {
  77. "type": "vcs",
  78. "url": "git@bitbucket.org:manifiesto/dashboard.git"
  79. }
  80. ]
  81. }

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

  1. spatie/laravel-ignition 2.2.0 requires illuminate/support (^10.0)
  2. laravel/laravel dev-develop requires laravel/framework (^9.2)
  3. 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.

  1. composer require "spatie/laravel-ignition:>=2.0.0" --with-all-dependencies
  2. ./composer.json has been updated
  3. Running composer update spatie/laravel-ignition --with-all-dependencies
  4. Loading composer repositories with package information
  5. Updating dependencies
  6. Your requirements could not be resolved to an installable set of packages.
  7. Problem 1
  8. - Root composer.json requires spatie/laravel-ignition >=2.0.0 -> satisfiable by spatie/laravel-ignition[2.0.0, ..., 2.2.0].
  9. - tightenco/ziggy is locked to version v1.6.0 and an update of this package was not requested.
  10. - tightenco/ziggy v1.6.0 requires laravel/framework >=5.4@dev -> satisfiable by laravel/framework[v9.2.0, ..., v9.52.10].
  11. - 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.
  12. - Conclusion: install illuminate/support v10.14.1 (conflict analysis result)
  13. Installation failed, reverting ./composer.json and ./composer.lock to their original content.
  1. composer require illuminate/support:10.14.1 && composer update illumiante/support
  2. ./composer.json has been updated
  3. Running composer update illuminate/support
  4. Loading composer repositories with package information
  5. Updating dependencies
  6. Your requirements could not be resolved to an installable set of packages.
  7. Problem 1
  8. - 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.
  9. Installation failed, reverting ./composer.json and ./composer.lock to their original content.
  1. composer why illuminate/support
  2. barryvdh/laravel-debugbar v3.8.1 requires illuminate/support (^9|^10)
  3. inspector-apm/inspector-laravel 4.7.31 requires illuminate/support (^5.5|^6.0|^7.0|^8.0|^9.0|^10.0)
  4. laravel/fortify v1.17.4 requires illuminate/support (^8.82|^9.0|^10.0)
  5. laravel/framework v9.52.10 replaces illuminate/support (self.version)
  6. laravel/jetstream v2.16.2 requires illuminate/support (^9.21|^10.0)
  7. laravel/sail v1.23.0 requires illuminate/support (^8.0|^9.0|^10.0)
  8. laravel/sanctum v3.2.5 requires illuminate/support (^9.21|^10.0)
  9. laravel/tinker v2.8.1 requires illuminate/support (^6.0|^7.0|^8.0|^9.0|^10.0)
  10. sentry/sentry-laravel 3.6.0 requires illuminate/support (^6.0 | ^7.0 | ^8.0 | ^9.0 | ^10.0)
  11. spatie/laravel-ignition 1.6.4 requires illuminate/support (^8.77|^9.27)
  1. composer update spatie/laravel-ignition -W
  2. Loading composer repositories with package information
  3. Updating dependencies
  4. Your requirements could not be resolved to an installable set of packages.
  5. Problem 1
  6. - Root composer.json requires spatie/laravel-ignition ^2.0 -> satisfiable by spatie/laravel-ignition[2.0.0, ..., 2.2.0].
  7. - tightenco/ziggy is locked to version v1.6.0 and an update of this package was not requested.
  8. - tightenco/ziggy v1.6.0 requires laravel/framework >=5.4@dev -> satisfiable by laravel/framework[v9.2.0, ..., v9.52.10].
  9. - 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.
  10. - 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

  1. Loading composer repositories with package information
  2. Updating dependencies
  3. Your requirements could not be resolved to an installable set of packages.
  4. Problem 1
  5. - Root composer.json requires illuminate/support ^10.0 -> satisfiable by illuminate/support[v10.0.0, ..., v10.14.1].
  6. - 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].
  7. - 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.
  8. - 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:

确定