paulatwilson's avatar

Trouble installing brand new Laravel 5.2.x project

Hi All,

I am trying to do a fresh install of Laravel and I am using the following command:

composer create-project --prefer-dist laravel/laravel thisproject

Everything seems to go fine until it hits the last stage where it runs artisan, I get the following error; I don't even know where to start:

Writing lock file
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
[BadMethodCallException]      
Method after does not exist.  

Script php artisan optimize handling the post-update-cmd event returned with an error

[RuntimeException]  
  Error Output:       
                      
create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--keep-vcs] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<directory>] [<version>]
0 likes
2 replies
jekinney's avatar

Try using the Laravel installer?

What OS are you using?

Is the project folder created and are you able to cd into it and run composer update or create?

paulatwilson's avatar
paulatwilson
OP
Best Answer
Level 1

Hi There,

I was jut about to amend this post as I now have a solution; it apparently is to do with New Relic and I have been given the following patch to solve it:

Kernel.php:

<?php namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
    protected $middleware = [
        \App\Http\Middleware\NewRelicPatch::class,
        //... your other middlewares
    ];
    //...
}

In \app\Http\Middleware

<?php
namespace App\Http\Middleware;
use Closure;
class NewRelicPatch
{
    public function handle($request, Closure $next)
    {
        $response = $next($request);
        event('router.filter:after:newrelic-patch', [$request, $response], true);
        return $response;
    }
}

Lastly in routes.php

<?php
Route::macro('after', function ($callback) {
    $this->events->listen('router.filter:after:newrelic-patch', $callback);
});

Thanks to: http://laravel.io/user/elite123

Please or to participate in this conversation.