I tried to update Laravel 5 today and here were the steps I had to take.
First checked my Laravel version before the update:
1 2 |
$ php artisan --version Laravel Framework version 5.0.35 |
Edited composer.json in my laravel’s root folder like such:
1 2 3 |
"require": { "laravel/framework": "5.2.*" } |
Run this on command line:
1 |
composer update |
You might need to delete root folder’s composer.lock file before the update can actually begin.
I got an error which I later fixed. Scroll to the bottom of the following message.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
$ composer update Loading composer repositories with package information Updating dependencies (including require-dev) - Removing symfony/filesystem (v2.8.6) - Removing symfony/security-core (v2.6.13) - Removing danielstjules/stringy (1.10.0) - Removing ircmaxell/password-compat (v1.0.4) - Removing vlucas/phpdotenv (v1.1.1) - Installing vlucas/phpdotenv (v2.2.1) Downloading: 100% - Installing symfony/polyfill-mbstring (v1.2.0) Downloading: 100% - Removing symfony/var-dumper (v2.6.13) - Installing symfony/var-dumper (v3.0.6) Downloading: 100% - Removing symfony/translation (v2.6.13) - Installing symfony/translation (v3.0.6) Downloading: 100% - Removing symfony/routing (v2.6.13) - Installing symfony/routing (v3.0.6) Downloading: 100% - Removing symfony/process (v2.6.13) - Installing symfony/process (v3.0.6) Downloading: 100% - Removing symfony/debug (v2.6.13) - Installing symfony/debug (v3.0.6) Downloading: 100% - Removing symfony/http-foundation (v2.6.13) - Installing symfony/http-foundation (v3.0.6) Downloading: 100% - Removing symfony/event-dispatcher (v2.8.6) - Installing symfony/event-dispatcher (v3.0.6) Downloading: 100% - Removing symfony/http-kernel (v2.6.13) - Installing symfony/http-kernel (v3.0.6) Downloading: 100% - Removing symfony/finder (v2.6.13) - Installing symfony/finder (v3.0.6) Downloading: 100% - Removing symfony/console (v2.6.13) - Installing symfony/console (v3.0.6) Downloading: 100% - Removing nikic/php-parser (v1.4.1) - Installing nikic/php-parser (v2.1.0) Downloading: 100% - Removing psy/psysh (v0.4.4) - Installing psy/psysh (v0.7.2) Downloading: 100% - Removing classpreloader/classpreloader (1.4.0) - Installing classpreloader/classpreloader (3.0.0) Downloading: 100% - Removing laravel/framework (v5.0.35) - Installing laravel/framework (v5.2.32) Downloading: 100% Writing lock file Generating autoload files > php artisan clear-compiled [Symfony\Component\Debug\Exception\FatalErrorException] Class 'Illuminate\Routing\ControllerServiceProvider' not found Script php artisan clear-compiled handling the post-update-cmd event returned with error code 255 |
So, Illuminate\Routing\ControllerServiceProvider’ could not be found.
What I did was remove the following line from config/app.php:
1 |
'Illuminate\Routing\ControllerServiceProvider', |
New error upon running php artisan –version:
1 2 |
[ErrorException] file_put_contents(E:\my\path\to\laravel\bootstrap/cache/services.php): failed to open stream: No such file or directory |
I created a folder named “cache” under bootstrap folder to solve that one.
Tried to check my Laravel version again, but this was the new error:
1 2 3 4 5 |
$ php artisan --version [Symfony\Component\Debug\Exception\FatalErrorException] Call to undefined method Illuminate\Bus\Dispatcher::mapUsing() |
Solution was this:
1 |
'App\Providers\BusServiceProvider' |
Then, finally!
1 2 |
$ php artisan --version Laravel Framework version 5.2.32 |
Oops, I can’t view my Laravel site on the web browser. It gives the following error:
1 2 |
FatalErrorException in Controller.php line 9: Trait 'Illuminate\Foundation\Bus\DispatchesCommands' not found |
I opened App/Http/Controllers/Controller.php
and replaced all instances of DispatchesCommands
with DispatchesJobs
.
Next web browser error:
1 2 |
InvalidArgumentException in AuthManager.php line 86: Auth guard [] is not defined. |
So I replaced the content of my config/auth.php
file with the following:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
<?php return [ /* |-------------------------------------------------------------------------- | Authentication Defaults |-------------------------------------------------------------------------- | | This option controls the default authentication "guard" and password | reset options for your application. You may change these defaults | as required, but they're a perfect start for most applications. | */ 'defaults' => [ 'guard' => 'web', 'passwords' => 'users', ], /* |-------------------------------------------------------------------------- | Authentication Guards |-------------------------------------------------------------------------- | | Next, you may define every authentication guard for your application. | Of course, a great default configuration has been defined for you | here which uses session storage and the Eloquent user provider. | | All authentication drivers have a user provider. This defines how the | users are actually retrieved out of your database or other storage | mechanisms used by this application to persist your user's data. | | Supported: "session", "token" | */ 'guards' => [ 'web' => [ 'driver' => 'session', 'provider' => 'users', ], 'api' => [ 'driver' => 'token', 'provider' => 'users', ], ], /* |-------------------------------------------------------------------------- | User Providers |-------------------------------------------------------------------------- | | All authentication drivers have a user provider. This defines how the | users are actually retrieved out of your database or other storage | mechanisms used by this application to persist your user's data. | | If you have multiple user tables or models you may configure multiple | sources which represent each model / table. These sources may then | be assigned to any extra authentication guards you have defined. | | Supported: "database", "eloquent" | */ 'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => App\User::class, ], // 'users' => [ // 'driver' => 'database', // 'table' => 'users', // ], ], /* |-------------------------------------------------------------------------- | Resetting Passwords |-------------------------------------------------------------------------- | | Here you may set the options for resetting passwords including the view | that is your password reset e-mail. You may also set the name of the | table that maintains all of the reset tokens for your application. | | You may specify multiple password reset configurations if you have more | than one user table or model in the application and you want to have | separate password reset settings based on the specific user types. | | The expire time is the number of minutes that the reset token should be | considered valid. This security feature keeps tokens short-lived so | they have less time to be guessed. You may change this as needed. | */ 'passwords' => [ 'users' => [ 'provider' => 'users', 'email' => 'auth.emails.password', 'table' => 'password_resets', 'expire' => 60, ], ], ]; |
Another error… Oh will this end soon?
1 2 |
ErrorException in somefile.php line 9: Object of class Illuminate\Routing\UrlGenerator could not be converted to string (View: D:\...\laravel\resources\views\app.blade.php) (View: D:\.../laravel\resources\views\app.blade.php) |
…which was caused by this code in my blade file:
1 |
<?php echo url(); ?> |
I simply passed a string “/” to the url() method to fix it. Then, ta-da! I could browse my Laravel site again via web browser.
Hello, I found this problem.
I think you have a copy of “Authenticate.php” like “Authenticate – Copy.php”
and You use “composer update”. This will re-build a classmap when update finished.
just go to “vendor\composer\autoload_classmap.php” and find
‘App\\Http\\Middleware\\Authenticate’ => $baseDir . ‘/app/Http/Middleware/Authenticate – Copy.php’,
Change it to
‘App\\Http\\Middleware\\Authenticate’ => $baseDir . ‘/app/Http/Middleware/Authenticate.php’,
Good Lucks!
You might need to delete root folder’s composer.lock file before the update can actually begin.