symfony / webpack-encore-bundle

Symfony integration with Webpack Encore!
https://symfony.com/webpack-encore
MIT License
940 stars 83 forks source link

Missing entrypoints.json when installing from scratch on Symfony #200

Closed 1manfactory closed 1 year ago

1manfactory commented 1 year ago

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

composer require symfony/webpack-encore-bundle

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 - but the whole folder public/build does not exist at all.

What do I have to do?

weaverryan commented 1 year ago

Hi there!

To fix this, continue on with the install steps here: https://symfony.com/doc/current/frontend/encore/installation.html#installing-encore-in-symfony-applications - specifically running yarn install or node install then building the Webpack assets (which you'll find on this page - https://symfony.com/doc/current/frontend/encore/simple-example.html - e.g. yarn watch).

If you're new to Encore, give that "Setting up your Project" page a quick read - it'll help clarify how things work :).

Cheers!