title: Deploy to heroku : Uncaught SyntaxError: Unexpected token <
body: <p>I have deployed mean stack api angular 6 to heroku , when I open the app on browser its displays brank page , </p>
  
  <p>In my server.js this is what i have </p>
  
  <pre><code>const express = require('express');
  const path = require('path');
  const flash = require('connect-flash');
  const bodyParser = require('body-parser');
  const cors = require('cors');
  const mongoose = require('mongoose');
  const db = require('./app/config/database');
  
  // Connect To Database
  mongoose.connect(db.database);
  
  // On Connection
  mongoose.connection.on('connected', () =&gt; {
    console.log('Connected to database '+db.database);
  });
  
  // On Error
  mongoose.connection.on('error', (err) =&gt; {
    console.log('Database error: '+err);
  });
  
  const app = express();
  
  const movies = require('./app/routes/movies');
  
  // Port Number
  const port = process.env.PORT || 8000
  
  // CORS Middleware
  app.use(cors());
  
  // Set Static Folder
  app.use(express.static(path.join(__dirname, '/movies-client/dist')));
  
  // Body Parser Middleware
  app.use(bodyParser.json());
  
  app.use('/movies', movies);
  
  app.get('*', (req, res) =&gt; {
    res.sendFile(path.join(__dirname + '/movies-client/dist/movies-client/index.html'));
  });
  // Start Server
  app.listen(port, () =&gt; {
    console.log('Server started on port '+port);
  });
  </code></pre>
  
  <p>when I run <code>heroku logs</code> ,  this is what I have </p>
  
  <pre><code>2018-06-20T11:27:14.549707+00:00 heroku[router]: at=info method=GET path="/" host=damp-reef-60581.herokuapp.com request_id=f44c5f42-2bd0-42de-8a5d-18551c306fd0 fwd="212.91.22.46" dyno=web.1 connect=0ms service=50ms status=200 bytes=1191 protocol=https
  2018-06-20T11:27:15.041658+00:00 heroku[router]: at=info method=GET path="/runtime.js" host=damp-reef-60581.herokuapp.com request_id=197ccaba-2fa8-42d6-8293-bc481fdf3fc3 fwd="212.91.22.46" dyno=web.1 connect=0ms service=16ms status=200 bytes=1191 protocol=https
  2018-06-20T11:27:15.313302+00:00 heroku[router]: at=info method=GET path="/styles.js" host=damp-reef-60581.herokuapp.com request_id=46f87c24-9a16-4d45-82e0-295b184dceec fwd="212.91.22.46" dyno=web.1 connect=0ms service=3ms status=200 bytes=1191 protocol=https
  2018-06-20T11:27:16.017486+00:00 heroku[router]: at=info method=GET path="/polyfills.js" host=damp-reef-60581.herokuapp.com request_id=7dd4bb06-ce65-472b-a8d3-106882666a11 fwd="212.91.22.46" dyno=web.1 connect=0ms service=9ms status=200 bytes=1191 protocol=https
  2018-06-20T11:27:16.015745+00:00 heroku[router]: at=info method=GET path="/main.js" host=damp-reef-60581.herokuapp.com request_id=1ec5edd6-632d-4b37-9984-fd076fe9a083 fwd="212.91.22.46" dyno=web.1 connect=0ms service=6ms status=200 bytes=1191 protocol=https
  2018-06-20T11:27:16.575143+00:00 heroku[router]: at=info method=GET path="/vendor.js" host=damp-reef-60581.herokuapp.com request_id=94178235-0013-49e6-aaa9-d34b84cc78ef fwd="212.91.22.46" dyno=web.1 connect=1ms service=3ms status=200 bytes=1191 protocol=https
  </code></pre>
  
  <p>when I inspect the browser this error is shown : </p>
  
  <pre><code>Uncaught SyntaxError: Unexpected token &lt;
  polyfills.js:1 Uncaught SyntaxError: Unexpected token &lt;
  styles.js:1 Uncaught SyntaxError: Unexpected token &lt;
  vendor.js:1 Uncaught SyntaxError: Unexpected token &lt;
  main.js:1 Uncaught SyntaxError: Unexpected token &lt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/7SYBI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7SYBI.png" alt="enter image description here"></a></p>
  
  <p>structre of the client app where I have dist files
  <a href="https://i.stack.imgur.com/5HVWn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5HVWn.png" alt="enter image description here"></a></p>
  
  <p>why am I getting this error? and how can I solve it? any help or suggestion will be helpfully</p>