Syntax Error in Angular App: Unexpected token <

后端 未结 30 2075
独厮守ぢ
独厮守ぢ 2020-12-02 20:16

I have an Angular app which runs perfectly in my local and production environment.. After a tiny change I made, I ran the app locally and it works fine.. Then I built the pr

30条回答
  •  醉梦人生
    2020-12-02 20:27

    Got this error as well using angular with express.

    I guess when you build an angular project the project is stored in 'dist/the-app' not just 'dist' so this solved my problem on express.

    // Point static path to dist
    app.use(express.static(path.join(__dirname, 'dist/the-app')));
    

    for me, this error was due to not setting the proper path of the built application.

提交回复
热议问题