Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

thaspius's avatar

Laravel 5 error - out of the box with update, route throws an error

I setup a new instance of laravel 5, got the hello route on navigating to the page. Great.

ran composer update in the folder and now the hello route is broken.

ErrorException (E_UNKNOWN) Argument 2 passed to Illuminate\Routing\RouteServiceProvider::namespaced() must be an instance of Closure, none given, called in F:\Tools\wamp\www\srpg\app\Providers\RouteServiceProvider.php on line 40 and defined

0 likes
17 replies
isimmons's avatar

Looks like Taylor changed the namespaced method just 2 hours ago. I'm guessing the update pulled in the framework update here https://github.com/laravel/framework/blob/master/src/Illuminate/Routing/RouteServiceProvider.php but didn't change your RouteServiceProvider to match so you could manually change it to match this https://github.com/laravel/laravel/blob/develop/app/Providers/RouteServiceProvider.php

UPDATE: May be obvious but also change the namespace to your actual namespace if you are using something besides 'App'

App::booted(function()
  {
   // Once the application has booted, we will include the default routes
   // file. This "namespace" helper will load the routes file within a
   // route group which automatically sets the controller namespace.
   $this->namespaced('Larabook\Http\Controllers', function()
   {
    require app_path().'/Http/routes.php';
   });
  });
4 likes
rspahni's avatar

Keep watching Taylor's commits here https://github.com/laravel/laravel/commits/develop or your L5 installation will occasionally cease to work before L5 is officially released. Commits affecting laravel/laravel (the "product" if you will) will not be synced by Composer, which pulls from laravel/framework.

1 like
bashy's avatar

Bear in mind, it's the dev-develop branch, expect issues...

thaspius's avatar

Yea, I expected issues, just wasn't sure where to look to fix it. I'll keep an eye on his github. Thanks for the help.

Klorox's avatar

You can update by hand or have git do it for you (expect conflicts):

git fetch laravel/laravel
git merge laravel/develop

use git mergetool to fix conflicts.

Klorox's avatar

Probably should have mentioned that lol. You could always add a remote right?
git remote add laravel git://github.com/laravel/laravel.git
git fetch laravel
git merge laravel/develop

2 likes
kryoll's avatar

Klorox that seems to have worked as expected, had to resolve a few conflicts first, but so far it seems good. Are there any implications of having the Laravel remote in my own git structure? Thanks!

Klorox's avatar

I have not run into any issues doing this. I always composer update first and check Taylor's commits. That way I know the conflicts I'm going to hit, so there are no surprises. Also when laravel 5 exits beta, this will no longer be necessary, as the skeleton should rarely change.

PratyushPundir's avatar

I updated my composer dependencies just today and ran into something that appears similar. The problem is, however, only restricted to views that use Blade templating since the default "hello.php" view loads just fine without changing anything else.

Here's my controller -

PagesController.php

<?php namespace L5App\Http\Controllers;


class PagesController {

     /*
     | Show the Home Page
     */
     public function index()
     {
         return view('index'); // gives the below error
         // return view('hello'); // works fine
     }
}

The "index.blade.php" view is a simple blade template that is in the exact same location (app/resources/views) as the default "hello.php" view that laravel comes with but I keep getting this error for the "index" blade view :

include(/b2b76b8fdd62476239b3c0c6347cb5ff): failed to open stream: No such file or directory (View: /home/vagrant/Sites/laravel5/resources/views/index.blade.php)

Any ideas on how to fix this?

bashy's avatar

That error is related to a commit a few days ago.

PratyushPundir's avatar

@bashy - Thanks for the prompt reply chief.. I figured it was related to the commits that Taylor has made recently but I thought I'd ask around since my issue is only cropping up with blade templates. It works fine with all other views that do not use blade. Will have to wait for a few more commits from Taylor I guess.. Thanks anyways \m/

bashy's avatar

Yeah I had the same issue after an update. I keep up to date pretty much every few hours to keep changes to a minimum! My install is updated and I do not get any errors with blade

PratyushPundir's avatar

Same here.. For all L5 apps that I have, I have been updating every day and it has been fine so far. But then I ran into this issue just today evening. First none of the views (blade or otherwise) were working. Could take care of that by following Taylor's commits but now it's a bit weird since I couldn't find any of the recent commits from Taylor that would only mess with blade templating. Will update if I can figure it out myself (unlikely with my intermediate level skills)..

bashy's avatar

There's been changes to where they're stored. Storage folder has been changed quite a bit but if you've done everything in the commits, make sure storage has read/write for web server and that you've tried deleting vendor folder/done composer dumpautoload along with deleting composer.lock

thyyppa's avatar

Adding

'compiled' => base_path().'/storage/compiled',

to config/view.php

and creating a writable storage/compiled directory worked for me.

Please or to participate in this conversation.