1

I am learning the symfony sonata bundle, I installed the symfony skeleton project with composer create-project symfony/website-skeleton sonata command, and I enter into sonata directory and run composer require sonata-project/admin-bundle command as the guide on symfonydoc, I checked all the configurations as the doc said, and the cache:clear and assets:install command all work fine, I started my server with php bin/console server:start, but when I visit the url 'http://localhost:8000/admin/dashboard' it reports error, An exception has been thrown during the rendering of a template ("Asset manifest file "/Users/kazuma/www/sonata/public/build/manifest.json" does not exist.").

I made my project with symfony before, but I don't know much about the webpack, my asset directory is empty, when I run npm install it works fine too, I don't know what I've missed.

lvpiao
  • 68
  • 3
  • I opened my 'public' directory, I can only find bundles 'directory' and index.php file under it, under the 'bundles' directory there are 'sonataadmin' and 'sonatacore' directories, no 'build' directory or any 'manifest.json' file under 'public' directory – lvpiao Jul 25 '18 at 08:06
  • do any of the answers [here](https://stackoverflow.com/questions/51393459/symfony-error-an-exception-has-been-thrown-during-the-rendering-of-a-template) help? – Dragos Jul 25 '18 at 09:29
  • @Dragos, Yes, the first answer there works, I set the 'assets' option in 'assets.yaml' as '~', it works, thank you very much! – lvpiao Jul 26 '18 at 01:15
  • running `yarn install` should do these for you automatically. – sylvery Feb 17 '20 at 04:34

1 Answers1

0

in Symfony 4

  1. Create le the empty file rootProject/public/build/manifest.json
  2. insert this code : enter image description here

{
    "bundles": {
        "Sonata\\AdminBundle\\SonataAdminBundle": ["all"]
    },
    "copy-from-recipe": {
        "config/": "%CONFIG_DIR%/",
        "src/": "%SRC_DIR%/"
    }
}
LF00
  • 22,077
  • 20
  • 117
  • 225