Did the following to create a new Symfony 6 project:
cd /var/www/html
composer create-project symfony/website-skeleton <project>
cd <project>
composer req --dev symfony/profiler-pack
composer req symfony/apache-pack
composer req maker doctrine twig
so far nothing special. Then
php bin/console make:controller
to create a simply Home-Controller
Then I wanted to install Bootstrap with Encore Bundle according to https://symfony.com/doc/current/frontend/encore/installation.html
Now when I open the website I get the error:
An exception has been thrown during the rendering of a template ("Could not find the entrypoints file from Webpack: the file "/var/www/html//public/build/entrypoints.json" does not exist.").
It’s this line/command causing the problem in templates/base.html.twig (line 9) :
{{ encore_entry_link_tags(‘app’) }}
Just as a hint: There is not only entrypoints.json missing – but the whole folder public/build does not exist at all.
What do I have to do?
2
Answers
After installing it with different methods (composer, yarn, npm etc.) using both Apache and symfony server and always running into the same error I had to use this command to (re)build the necessary folders and files to (at least) not run into the error again.
If the
public/build
folder is empty, that means you haven’t done any assets compilation.From here you can see that to compile assets you have to run e.g.
yarn dev
.