title: Remote Angular2 server hanging while serving development build
body: <p>I'm using a remote server for development of an Angular app (v4.4.3). The server is being served remotely for development and being accessed through a local browser. I.e.</p>
  
  <pre><code>ng serve --host URL --port 8080
  </code></pre>
  
  <p>It produces the following output:</p>
  
  <pre><code>Hash: 4691491fe6185644edc3                                                          Time: 10717ms
  chunk    {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 183 kB {4} [initial] [rendered]
  chunk    {1} main.bundle.js, main.bundle.js.map (main) 12 kB {3} [initial] [rendered]
  chunk    {2} styles.bundle.js, styles.bundle.js.map (styles) 147 kB {4} [initial] [rendered]
  chunk    {3} vendor.bundle.js, vendor.bundle.js.map (vendor) 2.49 MB [initial] [rendered]
  chunk    {4} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
  </code></pre>
  
  <p>Sometimes, it will start failing to load on the client:</p>
  
  <pre><code>GET http://[URL]:8080/vendor.bundle.js net::ERR_CONTENT_LENGTH_MISMATCH
  &gt; Uncaught TypeError: ...
  </code></pre>
  
  <p>This then persists. Sometimes, changing the code cause it to start working again. It goes away if I create a new project and copy the old files across, rebuilding it from scratch. It has happened on a number of projects, including the Tour of Heroes tutorial. Building the project for production and serving it via Apache works without any problems.</p>
  
  <p>I'm not doing anything special with the app, or loading any particular node packages. From what I can tell, it happens randomly. It seems to be caused by timing out while trying to download the bundles and not having loaded everything (thus having a mismatch of content length).</p>
  
  <p>I have tried the following things:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/44351273/neterr-content-length-mismatch-on-angular-2-on-docker-cloud#45008438">Flushing <code>node_modules</code></a></li>
  <li>Reverting to a previous version of the project (git)</li>
  <li>Restarting the server</li>
  </ul>
  
  <p>It is not caused by the following:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/33661058/neterr-content-length-mismatch-on-nginx-1-8-0">Permissions</a> (it was working fine before a minor change)</li>
  <li><a href="https://stackoverflow.com/questions/44212134/an-error-configuring-nginx-with-angular-2-failed-to-load-resource-neterr-con">Nginx in general</a> (I'm not using it?)</li>
  <li><a href="https://stackoverflow.com/questions/43124262/err-content-length-mismatch-node-express-angular">Express</a></li>
  </ul>
  
  <p>The only two things it could possibly be are:</p>
  
  <ul>
  <li>My server, but it <em>only</em> has this problem with Angular</li>
  <li>Angular, but I have no idea where. I've essentially reset it through a <code>git checkout</code> to an older, functioning version.</li>
  </ul>