Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php artisan schematics:install failed #21

Closed
saimyosett opened this issue Mar 9, 2020 · 7 comments
Closed

php artisan schematics:install failed #21

saimyosett opened this issue Mar 9, 2020 · 7 comments
Labels
duplicate This issue or pull request already exists

Comments

@saimyosett
Copy link

LogicException

at vendor/laravel/framework/src/Illuminate/Routing/Route.php:1039
1035| */
1036| public function prepareForSerialization()
1037| {
1038| if ($this->action['uses'] instanceof Closure) {

1039| throw new LogicException("Unable to prepare route [{$this->uri}] for serialization. Uses Closure.");
1040| }
1041|
1042| $this->compileRoute();
1043|

  +32 vendor frames

33 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

@brocorp-dev
Copy link

Hi guys,

Same behavior on a fresh Laravel 7.0.8 install.

If you remove all your route content (in api.php and web.php), install can run but you got this error when you visit {your-app}/schematics:

InvalidArgumentException HTTP 500 Internal Server Error Action Facade\Ignition\Http\Controllers\ExecuteSolutionController not defined.

@mtolhuys mtolhuys added the duplicate This issue or pull request already exists label Mar 9, 2020
@mtolhuys
Copy link
Owner

mtolhuys commented Mar 9, 2020

Hi @saimyosett ,

This is due to Laravel being unable to cache routes that contains closures. Duplicate of #11

@brocorp-dev I've just tested out in a fresh 7.0.8 myself. Didn't got any issues. By the looks of the Exception message you are getting it seems to be related to your facade\ignition setup though.

@ejntaylor
Copy link

Hi @mtolhuys I have this issue too, left a comment over here as marked as duplicate:

#11 (comment)

Not sure if that is best practice as it's a closed ticket, so leaving a note here if thats ok. Looking forward to trying Schematics out. Thanks

@Chouchen
Copy link

Chouchen commented Mar 9, 2020

I had the same bug, commented Artisan::call('route:cache'); in Install.php, relaunched php artisan schematics:install and it worked well.

I suggest something like this :

try {
    Artisan::call('route:cache');
} catch (\LogicException $e) {
     $this->warn('Routes couldn\'t be cached because of Closure.');
}

@mtolhuys
Copy link
Owner

mtolhuys commented Mar 9, 2020

Hi @raisonon & @Chouchen, I like the try / catch approach, including it now since this issue is coming up too much.

Like this:

Screenshot from 2020-03-09 18-28-51

@mtolhuys
Copy link
Owner

mtolhuys commented Mar 9, 2020

Done! 0.9.11 contains this.

@mtolhuys mtolhuys closed this as completed Mar 9, 2020
@ejntaylor
Copy link

Fab - so on a new install just head to web.php and api.php and remove the routes auto included (that use closures). Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

5 participants