簡體   English   中英

如何將 laravel/laravel 從 5.3 更新到 5.4?

[英]How can I update laravel/laravel from 5.3 to 5.4?

我試圖將laravel/laravel5.3更新到5.4 ,為此,我將composer.json修改為:

 {
        "name" : "laravel/laravel",
        "description" : "The Laravel Framework.",
        "keywords" : [
            "framework",
            "laravel"
        ],
        "license" : "MIT",
        "type" : "project",
        "require" : {
            "php" : ">=5.6.4",
            "laravel/framework" : "5.4.*",
            "h4cc/wkhtmltopdf-amd64" : "0.12.x",
            "h4cc/wkhtmltoimage-amd64" : "0.12.x",
            "barryvdh/laravel-snappy" : "^0.3.3",
            "greggilbert/recaptcha" : "dev-master"
        },
        "require-dev" : {
            "fzaninotto/faker" : "~1.4",
            "mockery/mockery" : "0.9.*",
            "phpunit/phpunit" : "~5.7",
            "symfony/css-selector" : "2.8.*|3.0.*",
            "symfony/dom-crawler" : "2.8.*|3.0.*",
            "barryvdh/laravel-ide-helper" : "^2.2",
            "guzzlehttp/guzzle" : "~6.0"
        },
        "autoload" : {
            "classmap" : [
                "database"
            ],
            "psr-4" : {
                "App\\" : "app/"
            }
        },
        "autoload-dev" : {
            "classmap" : [
                "tests/TestCase.php"
            ]
        },
        "scripts" : {
            "post-root-package-install" : "php -r \"copy('.env.example', '.env');\"",
            "post-create-project-cmd" : "php artisan key:generate",
            "post-install-cmd" : [
                "Illuminate\\Foundation\\ComposerScripts::postInstall",
                "php artisan optimize"
            ],
            "post-update-cmd" : [
                "Illuminate\\Foundation\\ComposerScripts::postUpdate",
                "php artisan optimize"
            ]
        },
        "config" : {
            "preferred-install" : "dist"
        }
    }

然后我跑了

$ composer update

似乎composer沒有做任何事情:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 0 updates, 0 removals
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
Generating optimized class loader
The compiled class file has been removed.

當我然后跑

$ php artisan --version

輸出是:

Laravel Framework version 5.3.31

composer.lock我發現這個:

    {
        "name": "laravel/framework",
        "version": "v5.3.31",
        "source": {
            "type": "git",
            "url": "https://github.com/laravel/framework.git",
            "reference": "e641e75fc5b26ad0ba8c19b7e83b08cad1d03b89"
        },
        "dist": {
            "type": "zip",
            "url": "https://api.github.com/repos/laravel/framework/zipball/e641e75fc5b26ad0ba8c19b7e83b08cad1d03b89",
            "reference": "e641e75fc5b26ad0ba8c19b7e83b08cad1d03b89",
            "shasum": ""
        },
        "require": {
            "classpreloader/classpreloader": "~3.0",
            "doctrine/inflector": "~1.0",
            "ext-mbstring": "*",
            "ext-openssl": "*",
            "jeremeamia/superclosure": "~2.2",
            "league/flysystem": "~1.0",
            "monolog/monolog": "~1.11",
            "mtdowling/cron-expression": "~1.0",
            "nesbot/carbon": "~1.20",
            "paragonie/random_compat": "~1.4|~2.0",
            "php": ">=5.6.4",
            "psy/psysh": "0.7.*|0.8.*",
            "ramsey/uuid": "~3.0",
            "swiftmailer/swiftmailer": "~5.4",
            "symfony/console": "3.1.*",
            "symfony/debug": "3.1.*",
            "symfony/finder": "3.1.*",
            "symfony/http-foundation": "3.1.*",
            "symfony/http-kernel": "3.1.*",
            "symfony/process": "3.1.*",
            "symfony/routing": "3.1.*",
            "symfony/translation": "3.1.*",
            "symfony/var-dumper": "3.1.*",
            "vlucas/phpdotenv": "~2.2"
        },
        "replace": {
            "illuminate/auth": "self.version",
            "illuminate/broadcasting": "self.version",
            "illuminate/bus": "self.version",
            "illuminate/cache": "self.version",
            "illuminate/config": "self.version",
            "illuminate/console": "self.version",
            "illuminate/container": "self.version",
            "illuminate/contracts": "self.version",
            "illuminate/cookie": "self.version",
            "illuminate/database": "self.version",
            "illuminate/encryption": "self.version",
            "illuminate/events": "self.version",
            "illuminate/exception": "self.version",
            "illuminate/filesystem": "self.version",
            "illuminate/hashing": "self.version",
            "illuminate/http": "self.version",
            "illuminate/log": "self.version",
            "illuminate/mail": "self.version",
            "illuminate/notifications": "self.version",
            "illuminate/pagination": "self.version",
            "illuminate/pipeline": "self.version",
            "illuminate/queue": "self.version",
            "illuminate/redis": "self.version",
            "illuminate/routing": "self.version",
            "illuminate/session": "self.version",
            "illuminate/support": "self.version",
            "illuminate/translation": "self.version",
            "illuminate/validation": "self.version",
            "illuminate/view": "self.version",
            "tightenco/collect": "self.version"
        },
        "require-dev": {
            "aws/aws-sdk-php": "~3.0",
            "mockery/mockery": "~0.9.4",
            "pda/pheanstalk": "~3.0",
            "phpunit/phpunit": "~5.4",
            "predis/predis": "~1.0",
            "symfony/css-selector": "3.1.*",
            "symfony/dom-crawler": "3.1.*"
        },
        "suggest": {
            "aws/aws-sdk-php": "Required to use the SQS queue driver and SES mail driver (~3.0).",
            "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.4).",
            "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).",
            "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers and the ping methods on schedules (~5.3|~6.0).",
            "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (~1.0).",
            "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (~1.0).",
            "pda/pheanstalk": "Required to use the beanstalk queue driver (~3.0).",
            "predis/predis": "Required to use the redis cache and queue drivers (~1.0).",
            "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (~2.0).",
            "symfony/css-selector": "Required to use some of the crawler integration testing tools (3.1.*).",
            "symfony/dom-crawler": "Required to use most of the crawler integration testing tools (3.1.*).",
            "symfony/psr-http-message-bridge": "Required to use psr7 bridging features (0.2.*)."
        },
        "type": "library",
        "extra": {
            "branch-alias": {
                "dev-master": "5.3-dev"
            }
        },

怎么了 ?

提前感謝您的幫助。

而不是編輯composer.json ,請嘗試運行

composer require laravel/laravel:^5.4.0 --update-with-dependencies

作為參考,請參閱https://getcomposer.org/doc/03-cli.md#require

--update-with-dependencies :還更新新需要的軟件包的依賴關系。

注意幾乎沒有理由手動修改composer.json ,尤其是沒有可用的相應命令時。

它適用於:

composer require laravel/framework:^5.4.0 --update-with-dependencies

它不起作用,但是有錯誤日志:

 composer require laravel/laravel:^5.4.0 --update-with-dependencies
./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
    - The requested package laravel/laravel No version set (parsed as 1.0.0) is satisfiable by laravel/laravel[No version set (parsed as 1.0.0)] but these conflict with your requirements or minimum-stability.
  Problem 2
    - laravel/laravel v5.5.0 requires php >=7.0.0 -> your PHP version (5.6.30) does not satisfy that requirement.
    - laravel/laravel v5.4.9 requires laravel/framework 5.4.* -> satisfiable by laravel/framework[5.4.x-dev, 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] but these conflict with your requirements or minimum-stability.
    - laravel/laravel v5.4.30 requires laravel/framework 5.4.* -> satisfiable by laravel/framework[5.4.x-dev, 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] but these conflict with your requirements or minimum-stability.
    - laravel/laravel v5.4.3 requires laravel/framework 5.4.* -> satisfiable by laravel/framework[5.4.x-dev, 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] but these conflict with your requirements or minimum-stability.
    - laravel/laravel v5.4.23 requires laravel/framework 5.4.* -> satisfiable by laravel/framework[5.4.x-dev, 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] but these conflict with your requirements or minimum-stability.
    - laravel/laravel v5.4.21 requires laravel/framework 5.4.* -> satisfiable by laravel/framework[5.4.x-dev, 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] but these conflict with your requirements or minimum-stability.
    - laravel/laravel v5.4.19 requires laravel/framework 5.4.* -> satisfiable by laravel/framework[5.4.x-dev, 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] but these conflict with your requirements or minimum-stability.
    - laravel/laravel v5.4.16 requires laravel/framework 5.4.* -> satisfiable by laravel/framework[5.4.x-dev, 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] but these conflict with your requirements or minimum-stability.
    - laravel/laravel v5.4.15 requires laravel/framework 5.4.* -> satisfiable by laravel/framework[5.4.x-dev, 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] but these conflict with your requirements or minimum-stability.
    - laravel/laravel v5.4.0 requires laravel/framework 5.4.* -> satisfiable by laravel/framework[5.4.x-dev, 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] but these conflict with your requirements or minimum-stability.
    - Installation request for laravel/laravel ^5.4.0 -> satisfiable by laravel/laravel[v5.4.0, v5.4.15, v5.4.16, v5.4.19, v5.4.21, v5.4.23, v5.4.3, v5.4.30, v5.4.9, v5.5.0].

我已經通過編輯幾個文件中的一些小改動將laravel項目從5.3轉換為5.4

如果想將 Laravel 5.3 升級到 Laravel5.4

您將laravel/framework: 5.3.* 更改為 5.4.*

你改phpunit/phpunit:̴~5.7

你改變: “laravelcollective/html”:“^5.4.0”

然后移動到您的終端並運行 composer update

如果存在,您可以刪除bootstrap/cache/compiled.php文件。 框架不再使用它。

升級所有軟件包后,您應該運行php artisan view:clear以避免與刪除 Illuminate\\View\\Factory::getFirstLoop()* 相關的 Blade 錯誤。 此外,您可能需要運行php artisan route:clear來刷新路由緩存。

做就是了

作曲家更新 laravel/framework --with-all-dependencies

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM