title: Node / Angular app Uncaught SyntaxError: Unexpected token <
body: <p>I'm following <a href="https://scotch.io/tutorials/creating-a-single-page-todo-app-with-node-and-angular" rel="noreferrer">this node/angular tutorial</a> and am getting the following errors:</p>
  
  <p><img src="https://i.stack.imgur.com/tg0gM.png" alt="enter image description here"></p>
  
  <p>I'm bootstrapping my app through node, which renders index page:</p>
  
  <pre><code>module.exports = function(app) {
  
      app.get('*', function(req, res) {
          res.sendfile('./public/index.html');
          ...
      });
  </code></pre>
  
  <p>Which renders:</p>
  
  <pre><code>&lt;html ng-app="DDE"&gt;
  &lt;head&gt;
      &lt;script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js"&gt;&lt;/script&gt;
      &lt;script src="bower_components/angular/angular.js"&gt;&lt;/script&gt;
      &lt;script src="bower_components/angular-route/angular-route.js"&gt;&lt;/script&gt;
  
      &lt;script src="js/app.js"&gt;&lt;/script&gt;
      &lt;script src="js/controllers/main.js"&gt;&lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
      This is the index page
      &lt;div ng-view&gt;&lt;/div&gt;
  </code></pre>
  
  <p>I'd like Node to handle the initial page load, but Angular to handle the rest of the routing. The problem is here: It doesn't seem my angular routing is working. I put a self-exec fn <code>run()</code> in there to test, but it's not being called.</p>
  
  <p>I'm simply trying to test display the <code>testpage.html</code> template:</p>
  
  <p><strong>app.js file:</strong></p>
  
  <pre><code>angular
      .module('DDE', [
          'ngRoute'
      ])
      .config(['$routeProvider',
          function($routeProvider) {
              $routeProvider.
                  when('/test', {
                      run : (function() {
                          alert('hit');
                      })(),
                      templateUrl: '../html/partials/testpage.html'
                  }).
                  otherwise({
                      redirectTo: '/test'
                  });
          }
      ]);
  </code></pre>
  
  <p>The angular error isn't very helpful. I'm not sure what <code>Unexpected token &lt;</code> means as I cannot find where I've added an extra <code>&lt;</code> anywhere.</p>
  
  <hr>
  
  <p>EDIT:</p>
  
  <pre><code>app.get('/', function(req, res) {
      res.send('./public/index.html'); 
  });
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/JKdL9.png" alt="enter image description here"></p>
  
  <p>It should be able to find the stuff in bower components as the pathing is correct:</p>
  
  <pre><code>root/bower_components/angular/angular.js
  root/bower_components/angular-route/angular-route.js
  </code></pre>