2015-12-21 134 views
49

我遵循官方upgrade guide從5.1到5.2。第一小節說:將Laravel 5.1升級到5.2時發生致命錯誤

如果要安裝Laravel 5.2的beta版本中,添加 "minimum-stability": "beta"您composer.json文件。

更新您的composer.json文件以指向laravel/framework 5.2.*

symfony/dom-crawler ~3.0symfony/css-selector ~3.0添加到您的composer.json文件的require-dev部分中的 部分。現在

,之後我介紹了上述變化和運行composer update,我得到以下錯誤(S):

PHP Fatal error: Class 'Illuminate\Routing\ControllerServiceProvider' not found 
in /home/vagrant/Code/myproject/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 146 

[Symfony\Component\Debug\Exception\FatalErrorException] 
Class 'Illuminate\Routing\ControllerServiceProvider' not found 

[RuntimeException] 
Error Output: PHP Fatal error: Class 'Illuminate\Routing\ControllerServiceProvider' not found in /home/vagrant/Code/myproject/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 146 

之後拋出錯誤更新完成,併發生「生成自動加載文件」。

什麼可能是錯誤的?

它看起來不像定製軟件包問題,而是一個核心問題。我是否應該繼續升級指導並運行composer update之後所有已調整到適合新的框架版本?

UPDATE

運行composer dump-autoload事後不會拋出錯誤如上所述。儘管如此,仍然令人困惑。

+3

在相關說明中,未來的讀者可能希望查看[Laravel Shift](https://laravelshift.com) - 一個用於Laravel項目的自動升級工具。 –

回答

53

沒有Illuminate\Routing\ControllerServiceProvider了。

如果我是你,我會我的應用程序的項目比較https://github.com/laravel/laravel/commits/develop,比如你看https://github.com/laravel/laravel/blob/develop/config/app.php你會看到默認提供的Laravel 5.2:

Illuminate\Auth\AuthServiceProvider::class, 
Illuminate\Broadcasting\BroadcastServiceProvider::class, 
Illuminate\Bus\BusServiceProvider::class, 
Illuminate\Cache\CacheServiceProvider::class, 
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, 
Illuminate\Cookie\CookieServiceProvider::class, 
Illuminate\Database\DatabaseServiceProvider::class, 
Illuminate\Encryption\EncryptionServiceProvider::class, 
Illuminate\Filesystem\FilesystemServiceProvider::class, 
Illuminate\Foundation\Providers\FoundationServiceProvider::class, 
Illuminate\Hashing\HashServiceProvider::class, 
Illuminate\Mail\MailServiceProvider::class, 
Illuminate\Pagination\PaginationServiceProvider::class, 
Illuminate\Pipeline\PipelineServiceProvider::class, 
Illuminate\Queue\QueueServiceProvider::class, 
Illuminate\Redis\RedisServiceProvider::class, 
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, 
Illuminate\Session\SessionServiceProvider::class, 
Illuminate\Translation\TranslationServiceProvider::class, 
Illuminate\Validation\ValidationServiceProvider::class, 
Illuminate\View\ViewServiceProvider::class, 
/* 
* Application Service Providers... 
*/ 
App\Providers\AppServiceProvider::class, 
App\Providers\AuthServiceProvider::class, 
App\Providers\EventServiceProvider::class, 
App\Providers\RouteServiceProvider::class, 
+1

這是否意味着我可以安全地從config/app.php中刪除條目? – lesssugar

+0

似乎是的,但你應該確保'app'文件夾的整個結構和文件內容與Laravel 5.2中的新內容匹配。 –

+0

好的,謝謝。升級指南實際上告訴我要在服務提供商部分刪除它。猜測在所有的代碼和結構已經調整之後更新作曲家的依賴關係會更好。 – lesssugar

17

在從5.1升級到5.2的現有項目我們發現,之前和之後的供應商

Illuminate\Routing\ControllerServiceProvider::class Illuminate\Foundation\Providers\ArtisanServiceProvider::class

去除線運行composer update是一個必要的順序得到laravel更新COMPLE TE。

運行之前將允許laravel下載和更新當前框架庫的依賴關係,然後取出後運行(作曲家才得以完成沒有問題)

我們還發現,在.ENV文件中的任何值,不能有空格並且必須用引號包圍才能工作。

7

更新config /下的app.php文件解決了一個問題,但引入了bootstrap/cache文件夾後,您可能會繼續運行相同的錯誤。

我跑了作曲家更新在刪除緩存的文件之前,所以我一直在打相同的錯誤。確保先刪除bootstrap/cache/services.php文件。

這可能是一個工匠的命令,但我完全錯過了文檔中的這一步。

+1

多數民衆贊成在幫助,使用RM引導/緩存/ *。PHP修復我的錯誤 –

17

從配置中取出兩個服務提供商/ app.php

Illuminate\Foundation\Providers\ArtisanServiceProvider::class, 
Illuminate\Routing\ControllerServiceProvider::class, 
1

我發現這裏的解決方案:

https://laravel.com/docs/5.2/upgrade#upgrade-5.2.0

服務提供商

照亮\基金會\ Providers \ ArtisanServiceProvider應該從您的app.php配置文件中的服務提供商列表中刪除。

Illuminate \ Routing \ ControllerServiceProvider應該從您的app.php配置文件中的服務提供商列表中刪除。