We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Service 'view' was not found in the dependency injection container (error in MVC Examples!)

Hi

I downloaded MVC Examples from here: https://github.com/phalcon/mvc

when I run 'multiple-shared-layouts' and some other example projects, encountring errors.

error for 'multiple-shared-layouts' is:

Service 'view' was not found in the dependency injection container


98.9k
Accepted
answer

This means a default module is not set so it cannot find the 'view' service which is set up on every module definition.

@phalcon and how do you set the default module?



98.9k
$router->setDefaultModule("frontend");

https://github.com/phalcon/biko/blob/master/config/routes.php#L4

@phalcon and how do you set the default module?