从 laravel 7 升级到 laravel 8
Posted
技术标签:
【中文标题】从 laravel 7 升级到 laravel 8【英文标题】:upgrade from laravel 7 to laravel 8 【发布时间】:2021-06-20 06:30:25 【问题描述】:我正在尝试从 laravel 7 升级到 8 错误我得到了错误
您的需求无法解决为一组可安装的软件包。
问题 1
- Conclusion: don't install laravel/framework v8.0.1 (conflict analysis result)
- Conclusion: don't install laravel/framework v8.0.2 (conflict analysis result)
- Conclusion: don't install laravel/framework v8.0.3 (conflict analysis result)
- Conclusion: don't install laravel/framework v8.33.0 (conflict analysis result)
- Conclusion: don't install laravel/framework v8.33.1 (conflict analysis result)
- laravel/horizon[v4.0.0, ..., v4.3.5] require illuminate/support ^7.0 -> satisfiable by illuminate/support[v7.0.0, ..., v7.30.4].
- Only one of these can be installed: illuminate/support[v5.0.0, ..., v5.8.36, v6.0.0, ..., v6.20.19, v7.0.0, ..., v7.30.4, v8.0.0, ..., v8.33.1], laravel/framework[v8.0.0, ..., v8.33.1]. laravel/framework replaces illuminate/support and thus cannot coexist with it.
- Root composer.json requires laravel/framework ^8.0 -> satisfiable by laravel/framework[v8.0.0, ..., v8.33.1].
- Root composer.json requires laravel/horizon ^4.0 -> satisfiable by laravel/horizon[v4.0.0, ..., v4.3.5].
使用选项 --with-all-dependencies (-W) 允许升级、降级和删除当前锁定到特定版本的软件包。
我的作曲家
"require":
"php": "^7.2",
"creativeorange/gravatar": "~1.0",
"doctrine/dbal": "^2.5",
"facade/ignition": "^2.3.6",
"fideloper/proxy": "~4.0",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.0",
"laravel/helpers": "^1.1",
"laravel/horizon": "^4.0",
"laravel/sanctum": "^2.3",
"laravel/tinker": "^2.0",
"laravel/ui": "^3.0",
"predis/predis": "^1.1",
"spatie/laravel-backup": "^6.10",
"spatie/laravel-permission": "^3.6",
"yajra/laravel-datatables-fractal": "^1.6",
"yajra/laravel-datatables-oracle": "^9.0"
,
"require-dev":
"composer/composer": "^1.9",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "~1.0",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.0"
,
什么是错误,我该如何解决?
【问题讨论】:
【参考方案1】:错误信息很清楚:
laravel/horizon[v4.0.0, ..., v4.3.5] 需要照明/支持 ^7.0 -> 可满足照明/支持[v7.0.0, ..., v7.30.4]。
您还需要更新所有其他软件包,例如 laravel/horizon
。目前,您需要与 Laravel 8 不兼容的 v4。将该软件包更新为与 Laravel 8兼容的 v5。
【讨论】:
我认为很好的解释 laravel.com/docs/8.x/upgrade中也明确提到Horizon需要升级到v5【参考方案2】:我使用了composer install --ignore-platform-reqs
,然后使用了php artisan serve
,它对我有用。
但在我们开始之前,我已经将composer.json
中的 PHP 和 Laravel 更新为我需要的版本。
【讨论】:
以上是关于从 laravel 7 升级到 laravel 8的主要内容,如果未能解决你的问题,请参考以下文章
如何将 App\Exceptions 从 laravel 7 升级到 laravel 8
从 laravel 6.x 升级到 laravel 7.0 时出错
从 Laravel 5.1 升级到 Laravel 5.8 后 whereHas() 变慢