2017-06-29 234 views
0

我想將Laravel更新到最新版本5.4。
但是直接遷移沒有在laravel migration guide中給出,所以首先我試圖將它遷移到laravel 5.3。
我的項目正在開發5.2 laravel版本並試圖升級它。從laravel 5.2升級到5.4

我已經更新了composer.json作爲指導進入laravel遷移指南的文檔。
並在命令行上運行命令composer update

我收到以下錯誤。

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

    Loading composer repositories with package information 

更新的依賴關係(包括要求-DEV) 你的要求不能被解析到一個安裝包集合。

Problem 1 
    - Conclusion: don't install laravel/framework v5.3.31 
    - Conclusion: don't install laravel/framework v5.3.30 
    - Conclusion: don't install laravel/framework v5.3.29 
    - Conclusion: don't install laravel/framework v5.3.28 
    - Conclusion: don't install laravel/framework v5.3.27 
    - Conclusion: don't install laravel/framework v5.3.26 
    - Conclusion: don't install laravel/framework v5.3.25 
    - Conclusion: don't install laravel/framework v5.3.24 
    - Conclusion: don't install laravel/framework v5.3.23 
    - Conclusion: don't install laravel/framework v5.3.22 
    - Conclusion: don't install laravel/framework v5.3.21 
    - Conclusion: don't install laravel/framework v5.3.20 
    - Conclusion: don't install laravel/framework v5.3.19 
    - Conclusion: don't install laravel/framework v5.3.18 
    - Conclusion: don't install laravel/framework v5.3.17 
    - Conclusion: don't install laravel/framework v5.3.16 
    - Conclusion: don't install laravel/framework v5.3.15 
    - Conclusion: don't install laravel/framework v5.3.14 
    - Conclusion: don't install laravel/framework v5.3.13 
    - Conclusion: don't install laravel/framework v5.3.12 
    - Conclusion: don't install laravel/framework v5.3.11 
    - Conclusion: don't install laravel/framework v5.3.10 
    - Conclusion: don't install laravel/framework v5.3.9 
    - Conclusion: don't install laravel/framework v5.3.8 
    - Conclusion: don't install laravel/framework v5.3.7 
    - Conclusion: don't install laravel/framework v5.3.6 
    - Conclusion: don't install laravel/framework v5.3.5 
    - Conclusion: don't install laravel/framework v5.3.4 
    - Conclusion: don't install laravel/framework v5.3.3 
    - Conclusion: don't install laravel/framework v5.3.2 
    - Conclusion: don't install laravel/framework v5.3.1 
    - laravelcollective/html v5.4 requires illuminate/view 5.4.* -> satisfiable by illuminate/view[v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.9]. 
    - laravelcollective/html v5.4.1 requires illuminate/view 5.4.* -> satisfiable by illuminate/view[v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.9]. 
    - laravelcollective/html v5.4.2 requires illuminate/view 5.4.* -> satisfiable by illuminate/view[v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.9]. 
    - laravelcollective/html v5.4.3 requires illuminate/view 5.4.* -> satisfiable by illuminate/view[v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.9]. 
    - laravelcollective/html v5.4.4 requires illuminate/view 5.4.* -> satisfiable by illuminate/view[v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.9]. 
    - laravelcollective/html v5.4.5 requires illuminate/view 5.4.* -> satisfiable by illuminate/view[v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.9]. 
    - laravelcollective/html v5.4.6 requires illuminate/view 5.4.* -> satisfiable by illuminate/view[v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.9]. 
    - laravelcollective/html v5.4.7 requires illuminate/view 5.4.* -> satisfiable by illuminate/view[v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.9]. 
    - laravelcollective/html v5.4.8 requires illuminate/view 5.4.* -> satisfiable by illuminate/view[v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.9]. 
    - don't install illuminate/view v5.4.0|don't install laravel/framework v5.3.0 
    - don't install illuminate/view v5.4.13|don't install laravel/framework v5.3.0 
    - don't install illuminate/view v5.4.17|don't install laravel/framework v5.3.0 
    - don't install illuminate/view v5.4.19|don't install laravel/framework v5.3.0 
    - don't install illuminate/view v5.4.27|don't install laravel/framework v5.3.0 
    - don't install illuminate/view v5.4.9|don't install laravel/framework v5.3.0 
    - Installation request for laravel/framework 5.3.* -> satisfiable by laravel/framework[v5.3.0, v5.3.1, v5.3.10, v5.3.11, v5.3.12, v5.3.13, v5.3.14, v5.3.15, v5.3.16, 
v5.3.17, v5.3.18, v5.3.19, v5.3.2, v5.3.20, v5.3.21, v5.3.22, v5.3.23, v5.3.24, v5.3.25, v5.3.26, v5.3.27, v5.3.28, v5.3.29, v5.3.3, v5.3.30, v5.3.31, v5.3.4, v5.3.5, v5. 
3.6, v5.3.7, v5.3.8, v5.3.9]. 
    - Installation request for laravelcollective/html ~5.4 -> satisfiable by laravelcollective/html[v5.4, v5.4.1, v5.4.2, v5.4.3, v5.4.4, v5.4.5, v5.4.6, v5.4.7, v5.4.8]. 

我需要在composer.json中進行哪些額外的更改才能使更新工作?

UPDATE:

這是composer.json

{ 
    "name": "laravel/laravel", 
    "description": "The Laravel Framework.", 
    "keywords": ["framework", "laravel"], 
    "license": "MIT", 
    "type": "project", 
    "require": { 
     "php": ">=5.5.9", 
     "laravel/framework": "5.3.*", 
     "twbs/bootstrap": "dev-master", 
     "laravelcollective/html": "~5.4", 
     "kepex/laravel-crud-generator": "^0.1.4", 
     "watson/bootstrap-form": "^1.0", 
     "doctrine/dbal": "^2.5", 
     "intervention/image": "dev-master", 
     "danvuquoc/laravel-kraken": "1.*", 
     "barryvdh/laravel-dompdf": "0.8.*", 
     "barryvdh/laravel-debugbar": "^2.2", 
     "barryvdh/laravel-snappy": "^0.3.0", 
     "danielboendergaard/phantom-pdf": "^1.2", 
     "h4cc/wkhtmltopdf-i386": "0.12.x", 
     "h4cc/wkhtmltoimage-i386": "0.12.x", 
     "h4cc/wkhtmltopdf-amd64": "0.12.x", 
     "knplabs/knp-snappy": "^0.4.3", 
     "wemersonjanuario/wkhtmltopdf-windows": "0.12.2.3", 
     "tymon/jwt-auth": "0.5.*", 
     "zizaco/entrust": "dev-laravel-5", 
     "eluceo/ical": "^0.11.0", 
     "jurosh/pdf-merge": "dev-master", 
     "torann/geoip": "^1.0", 
     "maatwebsite/excel": "~2.1.0", 
     "roumen/sitemap": "dev-master", 
     "guzzlehttp/guzzle": "^6.2", 
     "rackspace/php-opencloud": "dev-master", 
     "ellisthedev/laravel-5-robots": "~0.1.0", 
     "mpdf/mpdf": "^6.1", 
     "matthiasmullie/minify": "^1.3", 
     "lullabot/amp": "^1.0.0" 
    }, 
    "require-dev": { 
     "fzaninotto/faker": "~1.4", 
     "mockery/mockery": "0.9.*", 
     "phpunit/phpunit": "~4.0", 
     "symfony/css-selector": "2.8.*|3.0.*|3.1.*", 
     "symfony/dom-crawler": "2.8.*|3.0.*|3.1.*" 
    }, 
    "autoload": { 
     "classmap": ["database"], 
     "files": ["app/Http/helpers.php"], 
     "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" 
    } 
} 
+2

您需要從0.6.1升級包DOMPDF到最新版本。 ''dompdf/dompdf「:」^ 0.8「'在您的composer.json中更新版本 – Hari

+0

沒有好運的伴侶。我也試過這個。 – rahulsm

+0

仍然有相同的錯誤?或其他軟件包依賴版本的問題? – Hari

回答

0

我想你需要嘗試這個辦法:

必須更新第一LaravelCollective html package爲好。

在你composer.json,替換:

 
"laravelcollective/html": "5.2.*" 

有:

 
"laravelcollective/html": "5.4.*" 
+0

沒有好運隊友同樣的錯誤即將到來。但有一件事我注意到,錯誤行已被減少 – rahulsm

+0

哪些錯誤進來? –

0

必須更新第一barryvdh/laravel-DOMPDF包。

在你composer.json變化:

第一個變化

"laravel/framework": "5.3.*"前一個

,然後改變

"barryvdh/laravel-dompdf": "^0.6.1", 

"barryvdh/laravel-dompdf": "^0.8.0", 

然後打composer update命令

,然後改變"laravel/framework": "5.3.*"並再次打

`composer update` 

命令

+0

已經到最新版本 – rahulsm

+0

在你的錯誤顯示v0.6.1 –

+0

做一件事首先改變你的「laravel /框架」:「5.3。*」舊的,然後點擊作曲家更新命令。所以它會先更新「barryvdh/laravel-dompdf」包,而不會出現任何錯誤,然後更改「laravel/framework」:「5.3。*」 –

0

我從Laravel 5.2遷移到5.6。3以下是我的步驟:

首先,您需要更新提供商應用/提供商/ {EventServiceProvider,RouteServiceProvider} .php
他們啓動()方法不應該帶參數:

 ... 
- public function boot(DispatcherContract $events) 
+ public function boot() 
    { 
-  parent::boot($events); 
+  parent::boot(); 
    } 
    ... 

其次,更新您的composer.json。這是我的默認配置:

{ 
    "name": "laravel/laravel", 
    "description": "The Laravel Framework.", 
    "keywords": [ 
    "framework", 
    "laravel" 
    ], 
    "license": "MIT", 
    "type": "project", 
    "require": { 
    "php": ">=7.1.3", 
    "fideloper/proxy": "~4.0", 
    "laravel/framework": "5.6.*", 
    "laravel/tinker": "~1.0", 
    "laravelcollective/html": "^5.5.0" 
    }, 
    "require-dev": { 
    "barryvdh/laravel-debugbar": "^3.1", 
    "filp/whoops": "~2.0", 
    "fzaninotto/faker": "~1.4", 
    "mockery/mockery": "~1.0", 
    "nunomaduro/collision": "~2.0", 
    "phpunit/phpunit": "~7.0", 
    "symfony/thanks": "^1.0", 
    "doctrine/dbal": "^2.5" 
    }, 
    "autoload": { 
    "classmap": [ 
     "database/seeds", 
     "database/factories" 
    ], 
    "psr-4": { 
     "App\\": "app/" 
    } 
    }, 
    "autoload-dev": { 
    "psr-4": { 
     "Tests\\": "tests/" 
    } 
    }, 
    "extra": { 
    "laravel": { 
     "dont-discover": [ 
     ] 
    } 
    }, 
    "scripts": { 
    "post-root-package-install": [ 
     "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 
    ], 
    "post-create-project-cmd": [ 
     "@php artisan key:generate" 
    ], 
    "post-autoload-dump": [ 
     "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 
     "@php artisan package:discover" 
    ] 
    }, 
    "config": { 
    "preferred-install": "dist", 
    "sort-packages": true, 
    "optimize-autoloader": true 
    }, 
    "minimum-stability": "dev", 
    "prefer-stable": true 
} 

然後運行composer updatephp composer.phar update

從原來的倉庫取代應用程式/供應商/ RouteServiceProvider.php。

從應用/路線移動你的路由/ web.php路線/ web.php(最初,你可能還需要路由從原來的Laravel複製)

從認證更換你的控制器在文件夾應用程序/ Http /控制器/認證原始Laravel存儲庫

註釋掉你的舊認證路線,並在web.php路線文件(more about this)中添加Auth::routes();

從原始存儲庫中添加config/hashing.php

運行php artisan config:cache重置緩存。

最後,更新數據庫結構php artisan migrate --seed和運行應用程序php artisan serve

Original Laravel Repository