Reputation: 57
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.
Upvotes: 1
Views: 3809
Reputation: 4770
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
Upvotes: 3
Reputation: 7764
@Freelancer, the answer you gave was for Symfony2, be the op is using Symfony3.
The commands you need to clear the production cache are:
php bin/console cache:clear --env=prod
and to clear the dev (development) cache are:
php bin/console cache:clear
There is no need for the --no-debug. Also, a lot of time in the dev environment, you won't need to clear cache for certain changes (i.e. twig changes); but definitely clear the cache for prod when you make significant changes.
Edit #2. You might need to run this command as well:
$ php bin/console assetic:dump --env=prod --no-debug
Try it!
Upvotes: 4