1
votes

Hello
Am trying to run dev server using webpack encore by typing npm run dev-server, when checking the localhost:9000 is render me Cannot GET / and give that log

 「wds」: Project is running at http://localhost:9000/ 
 「wds」: webpack output is served from http://localhost:9000/build/
 「wds」: Content not from webpack is served from D:\xampp\htdocs\api-platform\public
 「wds」: 404s will fallback to /index.html 


knowing I already change package.json

"scripts": {
"dev-server": "encore dev-server --port 9000 --disable-host-check",
"dev": "encore dev",
"watch": "encore dev --watch",
"build": "encore production --progress"
},

and also take look on doc https://symfony.com/doc/current/frontend/encore/dev-server.html

Project structure
api-platform/node_modules
api-platform/public/build/entrypoints.json
api-platform/public/build/manifest.json
api-platform/package.json
api-platform/webpack.config.json

Controller

    /**
 * @Route("/", name="app")
 */
public function index()
{
    return $this->render('app/index.html.twig', []);
}
1
could you please share your project structure? - Abu Sufian
sure ill update it within the post. - Badr

1 Answers

0
votes

Finally am resolving that's by subscribing a few steps.

  1. Go to package.json and add port, disable-host-check to your dev-server:

    "dev-server": "encore dev-server --port 9000 --disable-host-check",

  2. Go to the host of your app(not of dev-server) and be sure to no have the same port between apache and dev-server.
    Cheers!