symfony / demo

Symfony Demo Application
https://symfony.com/
MIT License
2.48k stars 1.61k forks source link

The style are not showing in browser #1272

Closed alexbotnaru closed 1 year ago

alexbotnaru commented 2 years ago

I installed the application using the command : symfony new --demo my_project. It seems to work, but the styles and maybe the scripts are not working in browser, so the app looks like this: image I tried to run some commands like : composer install, composer require symfony/webpack-encore-bundle, npm install, npm run build but the problem persists. Any help?

stof commented 2 years ago

Are there any errors reported in your browser console ?

alexbotnaru commented 2 years ago

Yes image

bocharsky-bw commented 2 years ago

Hm, I can't reproduce this... my steps were:

  1. symfony new --demo my_project/
  2. cd my_project/
  3. symfony serve
  4. Open https://127.0.0.1:8000/

Styles are OK to me after this. Do you use the latest version of Symfony CLI? You can check by executing symfony self:update. If yes, what browser and OS do you use? What browser version? It may help I think

alexbotnaru commented 2 years ago

yeah, so I opened the project in Microsoft Edge and everythink works properly. I dont know why in Google Chrome i get those errors, as I have the last version of it (96.0.4664.45 ). Anyway, thanks a lot!

seb-jean commented 2 years ago

@alexbotnaru, Is it resolved?

acsig commented 1 year ago

This is still an issue. I just installed it now for the third time in a clean environment on a virtual machine.

It's hard to tell my students, that they need to install a node.js Webserver(!!!) and paket Manager npm/yarn to fix this issue. :-/ Any idea how to solve it?

javiereguiluz commented 1 year ago

Try to run only these commands:

composer create-project symfony/symfony-demo
cd symfony-demo
symfony serve

Then browse any page, and tell us the error logs that you see in the terminal that is running symfony serve. Thanks.

acsig commented 1 year ago

Looks like I found the problem:

different_path

Maybe consider the following: The symfony demo is intended to learn and teach symfony, to introduce people to symfony. After they installed XAMPP and composer, they're told "composer composes (a) symfony for you" BUT THEN i have to ask them to:

=> after that nobody is convinced anymore, that symfony and composer is a great, finetuned combination. :-/

Hope I could open your eyes a bit for problems some people might run into.

stof commented 1 year ago

Running a website in a subdirectory requires configuring webpack-encore to make it aware of that subdirectory. The committed files in this repo use a configuration expecting a deployment at the root.

  • install another webserver (node.js)

node.js is not a webserver. It is a language runtime.

And if you just want to run the demo and not rebuild its assets, you don't need to install node, yarn and the JS dependencies. That's precisely the reason why the output of the asset building is committed in the repo instead of being ignored (as is done in most projects). You need node.js if you want to run the asset building pipeline, because this pipeline relies on frontend tooling that is implemented in JS rather than in PHP.

javiereguiluz commented 1 year ago

@acsig I think there's been a misunderstanding. If you check the README of this repository, you'll see that to use this project to learn and teach Symfony, you only have to do this:

(1) Browse https://symfony.com/download (2) Install "Symfony CLI" according to your operating system (3) Open a terminal window (4) Run this command: symfony new --demo my_project (5) Run this command: cd my_project/ (6) Run this command: symfony serve (or symfony serve -d)

That's all you need to have this project working.

You don't need:

You don't have to install anything else. You don't have to run any commands to build assets. You don't need to configure any options.

I hope it's more clear now.

javiereguiluz commented 1 year ago

Let's close this one as hopefully fixed according to the latest comments. Thanks.