将 Laravel 从 5.3 升级到 5.4

Posted

技术标签:

【中文标题】将 Laravel 从 5.3 升级到 5.4【英文标题】:Upgrade Laravel to 5.4 from 5.3 【发布时间】:2018-04-23 08:17:19 【问题描述】:

我的项目正在开发5.3 laravel 版本并尝试升级它。

我已按照 laravel 指南文档的指导更新了 composer.json。 并在命令行上运行命令composer update

我收到以下错误。

Your requirements could not be resolved to an installable set of packages.

Problem 1
- Conclusion: don't install laravel/framework v5.4.36
- Conclusion: don't install laravel/framework v5.4.35
- Conclusion: don't install laravel/framework v5.4.34
- Conclusion: don't install laravel/framework v5.4.33
- Conclusion: don't install laravel/framework v5.4.32
- Conclusion: don't install laravel/framework v5.4.31
- Conclusion: don't install laravel/framework v5.4.30
- Conclusion: don't install laravel/framework v5.4.29
- Conclusion: don't install laravel/framework v5.4.28
- Conclusion: don't install laravel/framework v5.4.27
- Conclusion: don't install laravel/framework v5.4.26
- Conclusion: don't install laravel/framework v5.4.25
- Conclusion: don't install laravel/framework v5.4.24
- Conclusion: don't install laravel/framework v5.4.23
- Conclusion: don't install laravel/framework v5.4.22
- Conclusion: don't install laravel/framework v5.4.21
- Conclusion: don't install laravel/framework v5.4.20
- Conclusion: don't install laravel/framework v5.4.19
- Conclusion: don't install laravel/framework v5.4.18
- Conclusion: don't install laravel/framework v5.4.17
- Conclusion: don't install laravel/framework v5.4.16
- Conclusion: don't install laravel/framework v5.4.15
- Conclusion: don't install laravel/framework v5.4.14
- Conclusion: don't install laravel/framework v5.4.13
- Conclusion: don't install laravel/framework v5.4.12
- Conclusion: don't install laravel/framework v5.4.11
- Conclusion: don't install laravel/framework v5.4.10
- Conclusion: don't install laravel/framework v5.4.9
- Conclusion: don't install laravel/framework v5.4.8
- Conclusion: don't install laravel/framework v5.4.7
- Conclusion: don't install laravel/framework v5.4.6
- Conclusion: don't install laravel/framework v5.4.5
- Conclusion: don't install laravel/framework v5.4.4
- Conclusion: don't install laravel/framework v5.4.3
- Conclusion: don't install laravel/framework v5.4.2
- Conclusion: don't install laravel/framework v5.4.1
- cartalyst/stripe-laravel v5.0.1 requires illuminate/support 5.3.* -> satisfiable by laravel/framework[v5.3.31], illuminate/support[v5.3.0, v5.3.16, v5.3.23, v5.3.4].
- cartalyst/stripe-laravel v5.0.0 requires illuminate/support 5.3.* -> satisfiable by laravel/framework[v5.3.31], illuminate/support[v5.3.0, v5.3.16, v5.3.23, v5.3.4].
- cartalyst/stripe-laravel v5.0.1 requires illuminate/support 5.3.* -> satisfiable by laravel/framework[v5.3.31], illuminate/support[v5.3.0, v5.3.16, v5.3.23, v5.3.4].
- Can only install one of: laravel/framework[v5.4.0, v5.3.31].
- don't install illuminate/support v5.3.0|don't install laravel/framework v5.4.0
- don't install illuminate/support v5.3.16|don't install laravel/framework v5.4.0
- don't install illuminate/support v5.3.23|don't install laravel/framework v5.4.0
- don't install illuminate/support v5.3.4|don't install laravel/framework v5.4.0
- Installation request for laravel/framework 5.4.* -> satisfiable by laravel/framework[v5.4.0, v5.4.1, v5.4.10, v5.4.11, v5.4.12, v5.4.13, v5.4.14, v5.4.15, v5.4.16, v5.4.17, v5.4.18, v5.4.19, v5.4.2, v5.4.20, v5.4.21, v5.4.22, v5.4.23, v5.4.24, v5.4.25, v5.4.26, v5.4.27, v5.4.28, v5.4.29, v5.4.3, v5.4.30, v5.4.31, v5.4.32, v5.4.33, v5.4.34, v5.4.35, v5.4.36, v5.4.4, v5.4.5, v5.4.6, v5.4.7, v5.4.8, v5.4.9].
- Installation request for cartalyst/stripe-laravel 5.0.* -> satisfiable by cartalyst/stripe-laravel[v5.0.0, v5.0.1].

这是composer.json


"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": 
    "php": ">=5.5.9",
    "laravel/framework": "5.4.*",
    "intervention/image": "^2.3",
    "sly/notification-pusher": "^2.2",
    "baum/baum": "^1.1",

    "rtconner/laravel-tagging": "^2.0",
    "michele-angioni/laravel-js-lang-converter": "^2.1",
    "laravelcollective/html": "^5.2",
    "doctrine/dbal": "^2.5",
    "eluceo/ical": "^0.9.0",
    "twilio/sdk": "^4.10",
    "barryvdh/laravel-cors": "^0.8.1",
    "guzzlehttp/guzzle": "~6.0",
    "php-ffmpeg/php-ffmpeg": "^0.9.3",
    "cartalyst/stripe-laravel": "5.0.*"
,
"require-dev": 
    "fzaninotto/faker": "~1.4",
    "mockery/mockery": "0.9.*",
    "phpunit/phpunit": "~5.7",
    "symfony/css-selector": "3.1.*",
    "symfony/dom-crawler": "3.1.*"
,
"autoload": 
    "classmap": [
        "database",
        "app/Models",
      "app/Console/Commands"

    ],
    "files": [
      "app/helpers.php"
    ],
    "psr-4": 
        "App\\": "app/"
    
,
"autoload-dev": 
    "classmap": [
        "tests/TestCase.php"
    ]
,
"scripts": 
    "post-install-cmd": [
        "php artisan clear-compiled",
        "php artisan optimize"
    ],
    "post-update-cmd": [
        "php artisan clear-compiled",
        "php artisan optimize"
    ],
    "post-create-project-cmd": [
        "php -r \"copy('.env.example', '.env');\"",
        "php artisan key:generate"
    ]
,
"config": 
    "preferred-install": "dist"


任何帮助将不胜感激!

谢谢。

【问题讨论】:

【参考方案1】:

这是问题,因为您的某些软件包版本不支持新的 laravel 5.4版

例如

"cartalyst/stripe-laravel": "5.0.*"

cartalyst/stripe-laravel 5.0.1 版仅兼容 laravel 5.3 或更低版本,因此不支持您的新 laravel。

现在你有两种方法来更新你的 laravel

    您可以从您的 json 包中删除 "cartalyst/stripe-laravel": "5.0.*",然后像 composer require cartalyst/stripe-laravel 一样添加此命令,在您的系统中添加您的兼容版本 或者只是找到 cartalyst/stripe-laravel 的手动兼容版本并在你的包 json 表单中替换 cartakyst.stripe-laravel

【讨论】:

感谢您的回复!我认为"cartalyst/stripe-laravel": "6.0.*" 解决了我的问题!对吗? 您可以检查给定 url 上的“Laravel 兼容性”块 6.0.x 是 5.4 和 7.0.x 是 5.5 好的,谢谢。让我试试"cartalyst/stripe-laravel": "6.0.*",然后告诉你它是否有效! 给我这个错误:[RuntimeException] Could not delete /var/www/html/laravel-project/vendor/psy/psysh/test/fixtures/config.php: 您对供应商文件夹的权限或重命名供应商 vendor_old 并重试作曲家更新

以上是关于将 Laravel 从 5.3 升级到 5.4的主要内容,如果未能解决你的问题,请参考以下文章

Laravel 5.3 到 5.4 (mPdf - niklasravnsborg/laravel-pdf ) 升级问题

升级到 laravel 5.4 后调用未定义的方法

从 5.3 升级到 5.4 显示空白站点

laravel 5.4 在邮件中嵌入图像

将 Laravel 5.4 升级到最新版本 (5.7)

从 SonarQube 4.5.4 LTS 升级到 5.3 后,Ant 分析无法删除文件