【问题标题】:Can't update to Laravel 5.8 from 5.7无法从 5.7 更新到 Laravel 5.8
【发布时间】:2019-06-24 17:07:09
【问题描述】:

我正在尝试将我的网站从 Laravel 5.7 升级到 5.8。

我将composer.json 中的laravel/framework 更改为“5.8.*”,然后运行composer update,但composer 的结果是这样的:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
Carbon 1 is deprecated, see how to migrate to Carbon 2.
https://carbon.nesbot.com/docs/#api-carbon-2
    You can run './vendor/bin/upgrade-carbon' to get help in updating carbon and other frameworks and libraries that depend on it.
> @php artisan package:discover
Discovered Package: barryvdh/laravel-dompdf
Discovered Package: barryvdh/laravel-ide-helper
Discovered Package: fideloper/proxy
Discovered Package: laravel/nexmo-notification-channel
Discovered Package: laravel/slack-notification-channel
Discovered Package: laravel/tinker
Discovered Package: laravelcollective/html
Discovered Package: maatwebsite/excel
Discovered Package: nesbot/carbon
Discovered Package: staudenmeir/dusk-updater
Discovered Package: yajra/laravel-datatables-buttons
Discovered Package: yajra/laravel-datatables-editor
Discovered Package: yajra/laravel-datatables-fractal
Discovered Package: yajra/laravel-datatables-html
Discovered Package: yajra/laravel-datatables-oracle
Package manifest generated successfully.
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan ide-helper:generate
A new helper file was written to _ide_helper.php
> php artisan ide-helper:meta
A new meta file was written to .phpstorm.meta.php

我什至尝试更新 composer.lock 中的版本号,但这也没有用,它只是将版本恢复为“5.7.28”。

编辑 1:

也尝试删除composer.lock,但得到了类似的结果,这里是:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating optimized autoload files
Carbon 1 is deprecated, see how to migrate to Carbon 2.
https://carbon.nesbot.com/docs/#api-carbon-2
    You can run './vendor/bin/upgrade-carbon' to get help in updating carbon and other frameworks and libraries that depend on it.
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
Discovered Package: barryvdh/laravel-dompdf
Discovered Package: barryvdh/laravel-ide-helper
Discovered Package: fideloper/proxy
Discovered Package: laravel/nexmo-notification-channel
Discovered Package: laravel/slack-notification-channel
Discovered Package: laravel/tinker
Discovered Package: laravelcollective/html
Discovered Package: maatwebsite/excel
Discovered Package: nesbot/carbon
Discovered Package: staudenmeir/dusk-updater
Discovered Package: yajra/laravel-datatables-buttons
Discovered Package: yajra/laravel-datatables-editor
Discovered Package: yajra/laravel-datatables-fractal
Discovered Package: yajra/laravel-datatables-html
Discovered Package: yajra/laravel-datatables-oracle
Package manifest generated successfully.
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan ide-helper:generate
A new helper file was written to _ide_helper.php
> php artisan ide-helper:meta
A new meta file was written to .phpstorm.meta.php

编辑 2:

我这样做了:

composer require laravel/framework ^5.8

结果是:

./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: don't install laravel/framework v5.8.24
    - Conclusion: don't install laravel/framework v5.8.23
    - Conclusion: don't install laravel/framework v5.8.22
    - Conclusion: don't install laravel/framework v5.8.21
    - Conclusion: don't install laravel/framework v5.8.20
    - Conclusion: don't install laravel/framework v5.8.19
    - Conclusion: don't install laravel/framework v5.8.18
    - Conclusion: don't install laravel/framework v5.8.17
    - Conclusion: don't install laravel/framework v5.8.16
    - Conclusion: don't install laravel/framework v5.8.15
    - Conclusion: don't install laravel/framework v5.8.14
    - Conclusion: don't install laravel/framework v5.8.13
    - Conclusion: don't install laravel/framework v5.8.12
    - Conclusion: don't install laravel/framework v5.8.11
    - Conclusion: don't install laravel/framework v5.8.10
    - Conclusion: don't install laravel/framework v5.8.9
    - Conclusion: don't install laravel/framework v5.8.8
    - Conclusion: don't install laravel/framework v5.8.7
    - Conclusion: don't install laravel/framework v5.8.6
    - Conclusion: don't install laravel/framework v5.8.5
    - Conclusion: don't install laravel/framework v5.8.4
    - Conclusion: don't install laravel/framework v5.8.3
    - Conclusion: don't install laravel/framework v5.8.2
    - Conclusion: don't install laravel/framework v5.8.1
    - laravelcollective/html v5.7.1 requires illuminate/view 5.7.* -> satisfiable by laravel/framework[v5.7.28], illuminate/view[5.7.17, 5.7.18, 5.7.19, v5.7.0, v5.7.1, v5.7.10, v5.7.11, v5.7.15, v5.7.2, v5.7.20, v5.7.21, v5.7.22, v5.7.23, v5.7.26, v5.7.27, v5.7.28, v5.7.3, v5.7.4, v5.7.5, v5.7.6, v5.7.7, v5.7.8, v5.7.9].
    - laravelcollective/html v5.7.1 requires illuminate/view 5.7.* -> satisfiable by laravel/framework[v5.7.28], illuminate/view[5.7.17, 5.7.18, 5.7.19, v5.7.0, v5.7.1, v5.7.10, v5.7.11, v5.7.15, v5.7.2, v5.7.20, v5.7.21, v5.7.22, v5.7.23, v5.7.26, v5.7.27, v5.7.28, v5.7.3, v5.7.4, v5.7.5, v5.7.6, v5.7.7, v5.7.8, v5.7.9].
    - laravelcollective/html v5.7.1 requires illuminate/view 5.7.* -> satisfiable by laravel/framework[v5.7.28], illuminate/view[5.7.17, 5.7.18, 5.7.19, v5.7.0, v5.7.1, v5.7.10, v5.7.11, v5.7.15, v5.7.2, v5.7.20, v5.7.21, v5.7.22, v5.7.23, v5.7.26, v5.7.27, v5.7.28, v5.7.3, v5.7.4, v5.7.5, v5.7.6, v5.7.7, v5.7.8, v5.7.9].
    - Can only install one of: laravel/framework[v5.8.0, v5.7.28].
    - don't install illuminate/view 5.7.17|don't install laravel/framework v5.8.0
    - don't install illuminate/view 5.7.18|don't install laravel/framework v5.8.0
    - don't install illuminate/view 5.7.19|don't install laravel/framework v5.8.0
    - don't install illuminate/view v5.7.0|don't install laravel/framework v5.8.0
    - don't install illuminate/view v5.7.1|don't install laravel/framework v5.8.0
    - don't install illuminate/view v5.7.10|don't install laravel/framework v5.8.0
    - don't install illuminate/view v5.7.11|don't install laravel/framework v5.8.0
    - don't install illuminate/view v5.7.15|don't install laravel/framework v5.8.0
    - don't install illuminate/view v5.7.2|don't install laravel/framework v5.8.0
    - don't install illuminate/view v5.7.20|don't install laravel/framework v5.8.0
    - don't install illuminate/view v5.7.21|don't install laravel/framework v5.8.0
    - don't install illuminate/view v5.7.22|don't install laravel/framework v5.8.0
    - don't install illuminate/view v5.7.23|don't install laravel/framework v5.8.0
    - don't install illuminate/view v5.7.26|don't install laravel/framework v5.8.0
    - don't install illuminate/view v5.7.27|don't install laravel/framework v5.8.0
    - don't install illuminate/view v5.7.28|don't install laravel/framework v5.8.0
    - don't install illuminate/view v5.7.3|don't install laravel/framework v5.8.0
    - don't install illuminate/view v5.7.4|don't install laravel/framework v5.8.0
    - don't install illuminate/view v5.7.5|don't install laravel/framework v5.8.0
    - don't install illuminate/view v5.7.6|don't install laravel/framework v5.8.0
    - don't install illuminate/view v5.7.7|don't install laravel/framework v5.8.0
    - don't install illuminate/view v5.7.8|don't install laravel/framework v5.8.0
    - don't install illuminate/view v5.7.9|don't install laravel/framework v5.8.0
    - Installation request for laravel/framework ^5.8 -> satisfiable by laravel/framework[v5.8.0, v5.8.1, v5.8.10, v5.8.11, v5.8.12, v5.8.13, v5.8.14, v5.8.15, v5.8.16, v5.8.17, v5.8.18, v5.8.19, v5.8.2, v5.8.20, v5.8.21, v5.8.22, v5.8.23, v5.8.24, v5.8.3, v5.8.4, v5.8.5, v5.8.6, v5.8.7, v5.8.8, v5.8.9].
    - Installation request for laravelcollective/html (locked at v5.7.1) -> satisfiable by laravelcollective/html[v5.7.1].


Installation failed, reverting ./composer.json to its original content.

有什么想法吗?

【问题讨论】:

  • 你试过删除 composer.lock 吗?
  • 刚刚做了,将结果添加到我的问题中。
  • “无需安装或更新”意味着您已经是最新的了。检查composer.lock 并查看它显示的 Laravel 版本已安装。或者试试composer require laravel/framework ^5.8
  • composer.lock 显示 v5.7.28
  • 请您将composer.json 文件添加到您的问题中。

标签: php laravel composer-php laravel-5.8


【解决方案1】:

试试这个

composer require laravel/framework ^5.8 --update-with-dependencies

--update-with-dependencies:同时更新新需要的包的依赖,除了那些是根需求的包。

或者更新包时

composer update laravel/framework --with-dependencies

--with-dependencies:将白名单包的依赖添加到白名单中,除了那些是根需求的包。

换句话说,这将更新除 laravel/framework 之外的其他软件包,这些软件包是更新到 Laravel 5.8 所需的。

【讨论】:

  • 请注意,与require 命令一起使用时选项的名称是--update-with-dependencies
【解决方案2】:

您是否尝试按照错误消息中的建议运行./vendor/bin/upgrade-carbon?我最近遇到了不同框架的类似问题,但是在将 Carbon 升级到 v2 后,我可以更新我的框架和其他包。

【讨论】:

    猜你喜欢
    • 2020-05-10
    • 2019-09-03
    • 2020-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-03
    • 1970-01-01
    相关资源
    最近更新 更多