dongxinpa3101 2016-06-29 12:37
浏览 49

Symfony 3(Prod):您已请求不存在的服务“assetic.asset_manager”

I'm trying to run this cmd, which is supposed to dump assetic files for prod environment :

php bin/console assetic:dump --env=prod

This cmd returns the following error :

[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException] You have requested a non-existent service "assetic.asset_manager".

When i try to access the prod page through my browser, i've got the following error :

An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "_assetic_2f6a151_0" as such route does not exist.") in YOCoreBundle::layout.html.twig at line 14

Everything is working fine in the dev environment (static files are minified and stored in the right folder) when i run this cmd :

php bin/console assetic:dump

Regarding my configuration :

In composer.json :

{
  "require": {
     "symfony/assetic-bundle": "^2.8.0",
     "leafo/scssphp": "~0.6",
     "patchwork/jsqueeze": "~1.0"
  }
}

In app/config/config.yml i have the following code :

assetic:
  debug:          '%kernel.debug%'
  use_controller: '%kernel.debug%'
  filters:
    cssrewrite: ~
    jsqueeze:   ~
    scssphp:
      formatter: 'Leafo\ScssPhp\Formatter\Compressed'

AsseticBundle is declared in the AppKernel.php :

$bundles = [
  new Symfony\Bundle\AsseticBundle\AsseticBundle(),
];

I don't really know where the problem might be. If anyone has an idea about that, it would be really appreciated. Thanks in advance.

  • 写回答

2条回答 默认 最新

  • douzhe9927 2016-06-29 14:01
    关注

    It's probably a cache problem, as you said everything work fine in dev mode probably because symfony has regenerated the cache in dev but not into your prod env.

    I think you should run the following command to solve it:

    php bin/console cache:clear --env=prod
    
    评论

报告相同问题?